diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/controller/BaseIntegrationTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/controller/BaseIntegrationTest.java index b456a56a..14274b09 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/controller/BaseIntegrationTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/controller/BaseIntegrationTest.java @@ -15,7 +15,7 @@ import java.util.List; @SpringBootTest(classes = {EducGradStudentApiApplication.class}) -@ActiveProfiles("test") +@ActiveProfiles("integration-test") @AutoConfigureMockMvc public abstract class BaseIntegrationTest { diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java index 192f56a8..d48efe26 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java @@ -1,5 +1,10 @@ package ca.bc.gov.educ.api.gradstudent.support; +import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; +import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; +import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; +import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Subscriber; +import io.nats.client.Connection; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -11,7 +16,7 @@ /** * The type Mock configuration. */ -@Profile("test") +@Profile("integration-test") @Configuration public class MockConfiguration { @@ -27,4 +32,34 @@ public WebClient webClient() { return Mockito.mock(WebClient.class); } + @Bean + @Primary + public NatsConnection natsConnection() { + return Mockito.mock(NatsConnection.class); + } + + @Bean + @Primary + public Publisher publisher() { + return Mockito.mock(Publisher.class); + } + + @Bean + @Primary + public Subscriber subscriber() { + return Mockito.mock(Subscriber.class); + } + + @Bean + @Primary + public FetchGradStatusSubscriber fetchGradStatusSubscriber() { + return Mockito.mock(FetchGradStatusSubscriber.class); + } + + @Bean + @Primary + public Connection connection() { + return Mockito.mock(Connection.class); + } + } diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index bb142780..1bf87d6a 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -19,6 +19,8 @@ spring: hibernate: ddl-auto: create-drop generate-ddl: true + main: + allow-bean-definition-overriding: true mvc: log-request-details: true jackson: