Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(scheduler): Replace deprectated Mockito annotations #3456

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -24,7 +24,7 @@ public class ActiveScheduleDaoImplFailureTest {

@Autowired private ActiveScheduleDao activeScheduleDao;

@SpyBean private DataSource dataSource;
@MockitoSpyBean private DataSource dataSource;

@Autowired TestDataDbUtil testDataDbUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -75,23 +75,23 @@ 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;

@Autowired private ValidationErrorResult validationErrorResult;

@Autowired private TestDataDbUtil testDataDbUtil;

@SpyBean private RestOperations restOperations;
@MockitoSpyBean private RestOperations restOperations;

@Value("${autoscaler.scalingengine.url}")
private String scalingEngineUrl;
Expand Down
Loading