Skip to content

Commit

Permalink
GRAD2-3018 - Updates to UT
Browse files Browse the repository at this point in the history
  • Loading branch information
mightycox committed Oct 29, 2024
1 parent 0484f87 commit 93b3eb1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;

@SpringBootTest(classes = {EducGradStudentApiApplication.class})
@ActiveProfiles("test")
@ActiveProfiles("integration-test")
@AutoConfigureMockMvc
public abstract class BaseIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +16,7 @@
/**
* The type Mock configuration.
*/
@Profile("test")
@Profile("integration-test")
@Configuration
public class MockConfiguration {

Expand All @@ -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);
}

}
2 changes: 2 additions & 0 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 93b3eb1

Please sign in to comment.