diff --git a/order-service/pom.xml b/order-service/pom.xml index 02f2f716..88765a80 100644 --- a/order-service/pom.xml +++ b/order-service/pom.xml @@ -19,9 +19,9 @@ UTF-8 21 - 2023.0.3 + 2024.0.0 1.6.3 - 2.6.0 + 2.7.0 ${project.build.directory}/test-results 2.43.0 @@ -491,7 +491,7 @@ - 1.24.0 + 1.25.0 diff --git a/order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java b/order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java index 6d082506..5b9bd138 100644 --- a/order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java +++ b/order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java @@ -16,9 +16,9 @@ Licensed under MIT License Copyright (c) 2023-2024 Raja Kolli. public class TestOrderServiceApplication { public static void main(String[] args) { - System.setProperty("spring.profiles.active", AppConstants.PROFILE_LOCAL); SpringApplication.from(OrderServiceApplication::main) .with(ContainersConfig.class) + .withAdditionalProfiles(AppConstants.PROFILE_LOCAL) .run(args); } } diff --git a/order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java b/order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java index 93ad9280..e3a64f60 100644 --- a/order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java +++ b/order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java @@ -11,7 +11,7 @@ Licensed under MIT License Copyright (c) 2024 Raja Kolli. import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.context.annotation.Bean; import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.KafkaContainer; +import org.testcontainers.kafka.KafkaContainer; import org.testcontainers.utility.DockerImageName; @TestConfiguration(proxyBeanMethods = false) @@ -21,8 +21,7 @@ public class ContainersConfig { @ServiceConnection @RestartScope KafkaContainer kafkaContainer() { - return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.7.1")) - .withKraft() + return new KafkaContainer(DockerImageName.parse("apache/kafka-native").withTag("3.8.1")) .withReuse(true); } diff --git a/order-service/src/test/java/com/example/orderservice/web/controllers/OrderControllerTest.java b/order-service/src/test/java/com/example/orderservice/web/controllers/OrderControllerTest.java index 0d96db60..7834ec19 100644 --- a/order-service/src/test/java/com/example/orderservice/web/controllers/OrderControllerTest.java +++ b/order-service/src/test/java/com/example/orderservice/web/controllers/OrderControllerTest.java @@ -44,12 +44,12 @@ Licensed under MIT License Copyright (c) 2021-2024 Raja Kolli. import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @WebMvcTest(controllers = OrderController.class) @@ -58,11 +58,11 @@ class OrderControllerTest { @Autowired private MockMvc mockMvc; - @MockBean private OrderService orderService; + @MockitoBean private OrderService orderService; - @MockBean private OrderGeneratorService orderGeneratorService; + @MockitoBean private OrderGeneratorService orderGeneratorService; - @MockBean private OrderKafkaStreamService orderKafkaStreamService; + @MockitoBean private OrderKafkaStreamService orderKafkaStreamService; @Autowired private ObjectMapper objectMapper;