SchedulerHelperPropertiesVerifyProcess extends VerifyProcess { @Override protected void doVerify() throws Exception { upgradeConfiguration(); }    }
@Test public void testNoVerify() throws Exception { SchedulerHelperPropertiesVerifyProcess schedulerHelperPropertiesVerifyProcess = new SchedulerHelperPropertiesVerifyProcess(); schedulerHelperPropertiesVerifyProcess.props = PropsTestUtil.setProps( Collections.emptyMap()); ConfigurationAdmin configurationAdmin = Mockito.mock( ConfigurationAdmin.class); schedulerHelperPropertiesVerifyProcess.configurationAdmin = configurationAdmin; Mockito.when( configurationAdmin.getConfiguration( SchedulerEngineHelperConfiguration.class.getName()) ).then( new Answer<Object>() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { Assert.fail("No properties should have been verified"); return null; } } ); schedulerHelperPropertiesVerifyProcess.doVerify(); }
@Test public void testVerify() throws Exception { SchedulerHelperPropertiesVerifyProcess schedulerHelperPropertiesVerifyProcess = new SchedulerHelperPropertiesVerifyProcess(); schedulerHelperPropertiesVerifyProcess.props = PropsTestUtil.setProps( SchedulerHelperPropertiesVerifyProcess. LEGACY_AUDIT_MESSAGE_SCHEDULER_JOB, "true"); ConfigurationAdmin configurationAdmin = Mockito.mock( ConfigurationAdmin.class); schedulerHelperPropertiesVerifyProcess.configurationAdmin = configurationAdmin; Configuration configuration = Mockito.mock(Configuration.class); Mockito.when( configurationAdmin.getConfiguration( SchedulerEngineHelperConfiguration.class.getName(), StringPool.QUESTION) ).thenReturn( configuration ); schedulerHelperPropertiesVerifyProcess.doVerify(); Mockito.verify( configuration ).update( _argumentCaptor.capture() ); Dictionary<String, Object> dictionary = _argumentCaptor.getValue(); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals( Boolean.TRUE, dictionary.get( SchedulerHelperPropertiesVerifyProcess. AUDIT_SCHEDULER_JOB_ENABLED)); }