Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SpringBootTest(classes = MyAppApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
- @ActiveProfiles("test")
- public abstract class AbstractIntegrationTest {
- static {
- PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer().withPassword("password")
- .withUsername("postgres").withDatabaseName("MyApp");
- postgreSQLContainer.start();
- System.setProperty("spring.datasource.url", postgreSQLContainer.getJdbcUrl());
- System.setProperty("spring.datasource.password", postgreSQLContainer.getPassword());
- System.setProperty("spring.datasource.username", postgreSQLContainer.getUsername());
- }
- public class moreTests extends AbstractIntegrationTest {
- TestRestTemplate restTemplate = new TestRestTemplate("my-user", "password");
- HttpHeaders headers = new HttpHeaders();
- @Test
- public void SimpleHealthCheck() {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- ResponseEntity<String> response = restTemplate.exchange(
- createURLWithPort("/api/v1/healthcheck"),
- HttpMethod.GET, entity, String.class);
- assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
- }
- @Test
- public void GetInst() {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- ResponseEntity<String> response = restTemplate.exchange(
- createURLWithPort("/api/v1/institutions"),
- HttpMethod.GET, entity, String.class);
- assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement