Skip to content

Commit eab1f9c

Browse files
Merge branch 'main' of github.com:flowable/flowable-engine
2 parents 6f5fcfa + 3a752cc commit eab1f9c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/flowable-rest/src/test/java/org/flowable/rest/service/api/history/HistoricTaskInstanceResourceTest.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import static org.assertj.core.api.Assertions.assertThat;
1818
import static org.mockito.Mockito.when;
1919

20-
import java.util.Calendar;
20+
import java.time.Instant;
21+
import java.time.temporal.ChronoUnit;
2122
import java.util.Collections;
23+
import java.util.Date;
2224
import java.util.List;
2325
import java.util.Map;
2426

@@ -84,12 +86,12 @@ public void resetMocks() {
8486
@Deployment
8587
public void testGetProcessTask() throws Exception {
8688
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
87-
Calendar now = Calendar.getInstance();
88-
processEngineConfiguration.getClock().setCurrentTime(now.getTime());
89+
Date now = Date.from(Instant.now().truncatedTo(ChronoUnit.SECONDS));
90+
processEngineConfiguration.getClock().setCurrentTime(now);
8991

9092
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
9193
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
92-
taskService.setDueDate(task.getId(), now.getTime());
94+
taskService.setDueDate(task.getId(), now);
9395
taskService.setOwner(task.getId(), "owner");
9496
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
9597
assertThat(task).isNotNull();
@@ -131,8 +133,8 @@ public void testGetProcessAdhoc() throws Exception {
131133
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
132134
try {
133135

134-
Calendar now = Calendar.getInstance();
135-
processEngineConfiguration.getClock().setCurrentTime(now.getTime());
136+
Date now = Date.from(Instant.now().truncatedTo(ChronoUnit.SECONDS));
137+
processEngineConfiguration.getClock().setCurrentTime(now);
136138

137139
Task parentTask = taskService.newTask();
138140
taskService.saveTask(parentTask);
@@ -144,7 +146,7 @@ public void testGetProcessAdhoc() throws Exception {
144146
task.setAssignee("kermit");
145147
task.setDelegationState(DelegationState.RESOLVED);
146148
task.setDescription("Description");
147-
task.setDueDate(now.getTime());
149+
task.setDueDate(now);
148150
task.setOwner("owner");
149151
task.setPriority(20);
150152
taskService.saveTask(task);

0 commit comments

Comments
 (0)