Skip to content

Commit

Permalink
Set test order to avoid problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Sep 23, 2024
1 parent 254ddd7 commit 383ebed
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import org.apache.kafka.common.TopicPartition;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
Expand All @@ -28,6 +31,7 @@
classes = {Application.class},
webEnvironment = RANDOM_PORT
)
@TestMethodOrder(OrderAnnotation.class)
class ApplicationIT {

static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16-alpine");
Expand Down Expand Up @@ -61,20 +65,23 @@ static void configureProperties(final DynamicPropertyRegistry registry) {
}

@Test
@Order(1)
void specification_requests_work_as_expected() {
client.get("/v3/api-docs");
assertTrue(client.getResponseBody().contains("openapi"));
assertEquals(200, client.getResponseStatus().value());
}

@Test
@Order(2)
void actuator_requests_work_as_expected() {
client.get("/actuator/health");
assertTrue(client.getResponseBody().contains("UP"));
assertEquals(200, client.getResponseStatus().value());
}

@Test
@Order(3)
void existing_appointments_can_be_fetched() {
client.get("/appointments");
var response = client.getResponseBody(AppointmentResponse[].class);
Expand All @@ -84,6 +91,7 @@ void existing_appointments_can_be_fetched() {
}

@Test
@Order(4)
void appointments_can_be_created_read_and_deleted() {
client.post("/appointments", new AppointmentRequest()
.id(UUID.randomUUID())
Expand Down

0 comments on commit 383ebed

Please sign in to comment.