Select Git revision
MongoConfigServerTest.java 1.16 KiB
package de.ozgcloud.admin.environment;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import de.ozgcloud.admin.AdministrationApplication;
@SpringBootTest(classes = AdministrationApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT)
class MongoConfigServerTest {
private final String APPNAME = "testapp";
private final String PROFILE = "testprofile";
private final String LABEL = "testlabel";
@LocalServerPort
private int port;
@Test
void shouldHaveHttpEndpoint() {
ResponseEntity<Environment> response = new TestRestTemplate().getForEntity("http://localhost:"
+ port + "/" + APPNAME + "/" + PROFILE + "/" + LABEL, Environment.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
}
}