17
17
import static org .assertj .core .api .Assertions .assertThat ;
18
18
import static org .mockito .Mockito .when ;
19
19
20
- import java .util .Calendar ;
20
+ import java .time .Instant ;
21
+ import java .time .temporal .ChronoUnit ;
21
22
import java .util .Collections ;
23
+ import java .util .Date ;
22
24
import java .util .List ;
23
25
import java .util .Map ;
24
26
@@ -84,12 +86,12 @@ public void resetMocks() {
84
86
@ Deployment
85
87
public void testGetProcessTask () throws Exception {
86
88
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 );
89
91
90
92
ProcessInstance processInstance = runtimeService .startProcessInstanceByKey ("oneTaskProcess" );
91
93
Task task = taskService .createTaskQuery ().processInstanceId (processInstance .getId ()).singleResult ();
92
- taskService .setDueDate (task .getId (), now . getTime () );
94
+ taskService .setDueDate (task .getId (), now );
93
95
taskService .setOwner (task .getId (), "owner" );
94
96
task = taskService .createTaskQuery ().processInstanceId (processInstance .getId ()).singleResult ();
95
97
assertThat (task ).isNotNull ();
@@ -131,8 +133,8 @@ public void testGetProcessAdhoc() throws Exception {
131
133
if (processEngineConfiguration .getHistoryLevel ().isAtLeast (HistoryLevel .AUDIT )) {
132
134
try {
133
135
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 );
136
138
137
139
Task parentTask = taskService .newTask ();
138
140
taskService .saveTask (parentTask );
@@ -144,7 +146,7 @@ public void testGetProcessAdhoc() throws Exception {
144
146
task .setAssignee ("kermit" );
145
147
task .setDelegationState (DelegationState .RESOLVED );
146
148
task .setDescription ("Description" );
147
- task .setDueDate (now . getTime () );
149
+ task .setDueDate (now );
148
150
task .setOwner ("owner" );
149
151
task .setPriority (20 );
150
152
taskService .saveTask (task );
0 commit comments