DataCollectionQuartzJob { public void execute() throws Exception { if (collectionDriverManager == null) { return; } CollectionDriver driver = collectionDriverManager.getDriver(); if (driver != null) { String datacollectionEnable = new PropertiesUtil( CollectionDriverManager.getConfigurationFile()) .getProperty(driver.getCollectionSwitchName()); if (datacollectionEnable.trim().equalsIgnoreCase("true")) { logger.debug("Method execute of class DataCollectionQuartzJob is running."); Map<String, JobParameter> param = new TreeMap<String, JobParameter>(); param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter( new Date())); JobParameters jobParameters = new JobParameters(param); jobManager.runJob(CollectionConstants.COLLECT_DATA_JOB_NAME, jobParameters); } } }  Scheduler getScheduler(); void setScheduler(Scheduler scheduler); void execute(); JobManager getJobManager(); void setJobManager(JobManager jobManager); CollectionDriverManager getCollectionDriverManager(); void setCollectionDriverManager(
         CollectionDriverManager collectionDriverManager);  }
@Test(groups = { "TestDataCollectionQuartzJob" }) public void testExecute() throws Exception { Scheduler scheduler = mock(Scheduler.class); JobManager jobManager = mock(JobManager.class); CollectionDriver collectionDriver = mock(CollectionDriver.class); ICollectionInitializerService collectionInitializerService = Mockito.mock(FakeCollectionInitializerService.class); CollectOperationManager collectOperationManager = mock(CollectOperationManager.class); DataContainer dataContainer = mock(DataContainer.class); CollectionDriverManager collectionDriverManager = new FakeCollectionDriverManager(); DataCollectionQuartzJob dataCollectionQuartzJob = new DataCollectionQuartzJob(); collectionDriverManager.setDriverClass("com.vmware.bdd.manager.ph.PhoneHomeCollectionDriver"); collectionDriverManager.setCollectionInitializerService(collectionInitializerService); collectionDriverManager.setDriver(collectionDriver); collectionDriverManager.setCollectOperationManager(collectOperationManager); collectionDriverManager.setDataContainer(dataContainer); collectionDriverManager.setFile(file); dataCollectionQuartzJob .setCollectionDriverManager(collectionDriverManager); dataCollectionQuartzJob.setJobManager(jobManager); dataCollectionQuartzJob.setScheduler(scheduler); dataCollectionQuartzJob.execute(); verify(jobManager).runJob(eq(CollectionConstants.COLLECT_DATA_JOB_NAME), isA(JobParameters.class)); verify(collectionDriver, times(1)).getCollectionSwitchName(); }