@@ -143,7 +143,7 @@ public void testSuccessfulActivity() throws InterruptedException {
143
143
PendingActivityInfo actual = asserter .getActual ().getPendingActivities (0 );
144
144
145
145
// No fancy asserter type for PendingActivityInfo... we just build the expected proto
146
- PendingActivityInfo expected =
146
+ PendingActivityInfo . Builder expected =
147
147
PendingActivityInfo .newBuilder ()
148
148
.setActivityId (actual .getActivityId ())
149
149
.setActivityType (ActivityType .newBuilder ().setName ("TestDescribeActivity" ).build ())
@@ -160,10 +160,13 @@ public void testSuccessfulActivity() throws InterruptedException {
160
160
// going to run against the real server.
161
161
.setScheduledTime (actual .getScheduledTime ())
162
162
.setLastStartedTime (actual .getLastStartedTime ())
163
- .setExpirationTime (actual .getExpirationTime ())
164
- .build ();
163
+ .setExpirationTime (actual .getExpirationTime ());
165
164
166
- Assert .assertEquals ("PendingActivityInfo should match before" , expected , actual );
165
+ if (actual .hasActivityOptions ()) {
166
+ // If the activity options are present, we can assert them
167
+ expected .setActivityOptions (actual .getActivityOptions ());
168
+ }
169
+ Assert .assertEquals ("PendingActivityInfo should match before" , expected .build (), actual );
167
170
168
171
// Make the activity heartbeat - this should show in the next describe call
169
172
ThreadUtils .waitForWorkflow (token + "-heartbeat" );
@@ -181,11 +184,11 @@ public void testSuccessfulActivity() throws InterruptedException {
181
184
182
185
// Now, our PendingActivityInfo has heartbeat data, but is otherwise unchanged
183
186
expected =
184
- expected . toBuilder ()
187
+ expected
185
188
.setHeartbeatDetails (DescribeWorkflowAsserter .stringsToPayloads ("heartbeatDetails" ))
186
- .setLastHeartbeatTime (actual .getLastHeartbeatTime ())
187
- . build ();
188
- Assert . assertEquals ( "PendingActivityInfo should match after heartbeat" , expected , actual );
189
+ .setLastHeartbeatTime (actual .getLastHeartbeatTime ());
190
+ Assert . assertEquals (
191
+ "PendingActivityInfo should match after heartbeat" , expected . build () , actual );
189
192
190
193
// Let the activity finish, which will let the workflow finish.
191
194
ThreadUtils .waitForWorkflow (token + "-finish" );
@@ -241,7 +244,7 @@ public void testFailedActivity() throws InterruptedException {
241
244
"Activity was asked to fail on attempt 1" ,
242
245
actual .getLastFailure ().getMessage ());
243
246
244
- PendingActivityInfo expected =
247
+ PendingActivityInfo . Builder expected =
245
248
PendingActivityInfo .newBuilder ()
246
249
.setActivityId (actual .getActivityId ())
247
250
.setActivityType (ActivityType .newBuilder ().setName ("TestDescribeActivity" ).build ())
@@ -258,10 +261,13 @@ public void testFailedActivity() throws InterruptedException {
258
261
// it.
259
262
.setLastWorkerIdentity (actual .getLastWorkerIdentity ())
260
263
// We don't deeply assert the failure structure since we asserted the message above
261
- .setLastFailure (actual .getLastFailure ())
262
- .build ();
264
+ .setLastFailure (actual .getLastFailure ());
265
+ if (actual .hasActivityOptions ()) {
266
+ // If the activity options are present, we can assert them
267
+ expected .setActivityOptions (actual .getActivityOptions ());
268
+ }
263
269
264
- Assert .assertEquals ("PendingActivityInfo should match" , expected , actual );
270
+ Assert .assertEquals ("PendingActivityInfo should match" , expected . build () , actual );
265
271
266
272
// Now let the workflow succeed
267
273
ThreadUtils .waitForWorkflow (token + "-finish" );
@@ -311,7 +317,7 @@ private void testKilledWorkflow(
311
317
312
318
PendingActivityInfo actual = asserter .getActual ().getPendingActivities (0 );
313
319
314
- PendingActivityInfo expected =
320
+ PendingActivityInfo . Builder expected =
315
321
PendingActivityInfo .newBuilder ()
316
322
.setActivityId (actual .getActivityId ())
317
323
.setActivityType (ActivityType .newBuilder ().setName ("TestDescribeActivity" ).build ())
@@ -325,10 +331,13 @@ private void testKilledWorkflow(
325
331
.setExpirationTime (actual .getExpirationTime ())
326
332
// this ends up being a dummy value, but if it weren't, we still wouldn't expect to know
327
333
// it.
328
- .setLastWorkerIdentity (actual .getLastWorkerIdentity ())
329
- .build ();
334
+ .setLastWorkerIdentity (actual .getLastWorkerIdentity ());
335
+ if (actual .hasActivityOptions ()) {
336
+ // If the activity options are present, we can assert them
337
+ expected .setActivityOptions (actual .getActivityOptions ());
338
+ }
330
339
331
- Assert .assertEquals ("PendingActivityInfo should match" , expected , actual );
340
+ Assert .assertEquals ("PendingActivityInfo should match" , expected . build () , actual );
332
341
}
333
342
334
343
@ Test
0 commit comments