diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/dao/ActiveScheduleDaoImplFailureTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/dao/ActiveScheduleDaoImplFailureTest.java index d3eb3a8ee7..b8a479ed0a 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/dao/ActiveScheduleDaoImplFailureTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/dao/ActiveScheduleDaoImplFailureTest.java @@ -15,7 +15,7 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -24,7 +24,7 @@ public class ActiveScheduleDaoImplFailureTest { @Autowired private ActiveScheduleDao activeScheduleDao; - @SpyBean private DataSource dataSource; + @MockitoSpyBean private DataSource dataSource; @Autowired TestDataDbUtil testDataDbUtil; diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/quartz/AppScalingScheduleJobTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/quartz/AppScalingScheduleJobTest.java index d4a965693d..22d9bd3d62 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/quartz/AppScalingScheduleJobTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/quartz/AppScalingScheduleJobTest.java @@ -47,10 +47,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpEntity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.ResourceAccessException; import org.springframework.web.client.RestOperations; @@ -62,9 +62,9 @@ public class AppScalingScheduleJobTest { private static EmbeddedTomcatUtil embeddedTomcatUtil; @Autowired private MessageBundleResourceHelper messageBundleResourceHelper; private Scheduler memScheduler; - @MockBean private Scheduler scheduler; - @MockBean private ActiveScheduleDao activeScheduleDao; - @SpyBean private RestOperations restOperations; + @MockitoBean private Scheduler scheduler; + @MockitoBean private ActiveScheduleDao activeScheduleDao; + @MockitoSpyBean private RestOperations restOperations; @Autowired private TestDataDbUtil testDataDbUtil; @Autowired private ApplicationContext applicationContext; diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleRestControllerTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleRestControllerTest.java index 6251de0c51..bc4fc1881b 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleRestControllerTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleRestControllerTest.java @@ -38,10 +38,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; @@ -54,9 +54,9 @@ @DirtiesContext(classMode = ClassMode.BEFORE_CLASS) public class ScheduleRestControllerTest { - @MockBean private Scheduler scheduler; + @MockitoBean private Scheduler scheduler; - @MockBean private ActiveScheduleDao activeScheduleDao; + @MockitoBean private ActiveScheduleDao activeScheduleDao; @Autowired private SpecificDateScheduleDao specificDateScheduleDao; diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleSyncRestControllerTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleSyncRestControllerTest.java index 14806e4f00..61d2ac06aa 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleSyncRestControllerTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/rest/ScheduleSyncRestControllerTest.java @@ -21,9 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; @@ -35,9 +35,9 @@ @DirtiesContext(classMode = ClassMode.BEFORE_CLASS) public class ScheduleSyncRestControllerTest { - @MockBean private Scheduler scheduler; + @MockitoBean private Scheduler scheduler; - @MockBean private ActiveScheduleDao activeScheduleDao; + @MockitoBean private ActiveScheduleDao activeScheduleDao; @Autowired private TestDataDbUtil testDataDbUtil; diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleJobManagerTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleJobManagerTest.java index 72358fa67e..e7ce0a6164 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleJobManagerTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleJobManagerTest.java @@ -55,16 +55,16 @@ import org.quartz.TriggerKey; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ScheduleJobManagerTest { - @MockBean private Scheduler scheduler; + @MockitoBean private Scheduler scheduler; - @MockBean private ActiveScheduleDao activeScheduleDao; + @MockitoBean private ActiveScheduleDao activeScheduleDao; @Autowired private ScheduleJobManager scheduleJobManager; diff --git a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleManagerTest.java b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleManagerTest.java index eef163249f..9988017009 100644 --- a/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleManagerTest.java +++ b/src/scheduler/src/test/java/org/cloudfoundry/autoscaler/scheduler/service/ScheduleManagerTest.java @@ -58,10 +58,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.client.ExpectedCount; import org.springframework.test.web.client.MockRestServiceServer; @@ -75,15 +75,15 @@ public class ScheduleManagerTest { @Autowired private ScheduleManager scheduleManager; - @MockBean private PolicyJsonDao policyJsonDao; + @MockitoBean private PolicyJsonDao policyJsonDao; - @MockBean private SpecificDateScheduleDao specificDateScheduleDao; + @MockitoBean private SpecificDateScheduleDao specificDateScheduleDao; - @MockBean private RecurringScheduleDao recurringScheduleDao; + @MockitoBean private RecurringScheduleDao recurringScheduleDao; - @MockBean private ActiveScheduleDao activeScheduleDao; + @MockitoBean private ActiveScheduleDao activeScheduleDao; - @MockBean private ScheduleJobManager scheduleJobManager; + @MockitoBean private ScheduleJobManager scheduleJobManager; @Autowired private MessageBundleResourceHelper messageBundleResourceHelper; @@ -91,7 +91,7 @@ public class ScheduleManagerTest { @Autowired private TestDataDbUtil testDataDbUtil; - @SpyBean private RestOperations restOperations; + @MockitoSpyBean private RestOperations restOperations; @Value("${autoscaler.scalingengine.url}") private String scalingEngineUrl;