Source:
<code>public void testQueryByDeploymentTimeAfter() { <START> Date startTest = DateUtils.addSeconds(ClockUtil.now(), 5); ClockUtil.setCurrentTime(startTest); <END> ClockUtil.setCurrentTime(DateUtils.addSeconds(startTest, 5)); Deployment tempDeploymentOne = repositoryService.createDeployment() .addClasspathResource(DMN_ONE_RESOURCE).addClasspathResource(DMN_TWO_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentOne); Date timeAfterDeploymentOne = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentOne, 5)); Deployment tempDeploymentTwo = repositoryService.createDeployment() .addClasspathResource(DMN_ONE_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentTwo); Date timeAfterDeploymentTwo = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentTwo, 5)); Deployment tempDeploymentThree = repositoryService.createDeployment() .addClasspathResource(DMN_THREE_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentThree); Date timeAfterDeploymentThree = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(startTest).list(); assertThat(decisionDefinitions).hasSize(4); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentOne).list(); assertThat(decisionDefinitions).hasSize(2); assertThatDecisionDefinitionsWereDeployedAfter(decisionDefinitions, timeAfterDeploymentOne); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentTwo).list(); assertThat(decisionDefinitions).hasSize(1); assertThatDecisionDefinitionsWereDeployedAfter(decisionDefinitions, timeAfterDeploymentTwo); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); assertThat(decisionDefinitions).hasSize(0); }</code><technical_language>This duplicate call ClockUtil#setCurrentTime is necessary</technical_language>

Target:
public void testQueryByDeploymentTimeAfter() { Date startTest = DateUtils.addSeconds(ClockUtil.now(), 5); ClockUtil.setCurrentTime(DateUtils.addSeconds(startTest, 5)); Deployment tempDeploymentOne = repositoryService.createDeployment() .addClasspathResource(DMN_ONE_RESOURCE).addClasspathResource(DMN_TWO_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentOne); Date timeAfterDeploymentOne = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentOne, 5)); Deployment tempDeploymentTwo = repositoryService.createDeployment() .addClasspathResource(DMN_ONE_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentTwo); Date timeAfterDeploymentTwo = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentTwo, 5)); Deployment tempDeploymentThree = repositoryService.createDeployment() .addClasspathResource(DMN_THREE_RESOURCE).deploy(); engineRule.manageDeployment(tempDeploymentThree); Date timeAfterDeploymentThree = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(startTest).list(); assertThat(decisionDefinitions).hasSize(4); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentOne).list(); assertThat(decisionDefinitions).hasSize(2); assertThatDecisionDefinitionsWereDeployedAfter(decisionDefinitions, timeAfterDeploymentOne); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentTwo).list(); assertThat(decisionDefinitions).hasSize(1); assertThatDecisionDefinitionsWereDeployedAfter(decisionDefinitions, timeAfterDeploymentTwo); decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); assertThat(decisionDefinitions).hasSize(0); }