@@ -143,7 +143,7 @@ public void testSuccessfulActivity() throws InterruptedException {
143143 PendingActivityInfo actual = asserter .getActual ().getPendingActivities (0 );
144144
145145 // No fancy asserter type for PendingActivityInfo... we just build the expected proto
146- PendingActivityInfo expected =
146+ PendingActivityInfo . Builder expected =
147147 PendingActivityInfo .newBuilder ()
148148 .setActivityId (actual .getActivityId ())
149149 .setActivityType (ActivityType .newBuilder ().setName ("TestDescribeActivity" ).build ())
@@ -160,10 +160,13 @@ public void testSuccessfulActivity() throws InterruptedException {
160160 // going to run against the real server.
161161 .setScheduledTime (actual .getScheduledTime ())
162162 .setLastStartedTime (actual .getLastStartedTime ())
163- .setExpirationTime (actual .getExpirationTime ())
164- .build ();
163+ .setExpirationTime (actual .getExpirationTime ());
165164
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 );
167170
168171 // Make the activity heartbeat - this should show in the next describe call
169172 ThreadUtils .waitForWorkflow (token + "-heartbeat" );
@@ -181,11 +184,11 @@ public void testSuccessfulActivity() throws InterruptedException {
181184
182185 // Now, our PendingActivityInfo has heartbeat data, but is otherwise unchanged
183186 expected =
184- expected . toBuilder ()
187+ expected
185188 .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 );
189192
190193 // Let the activity finish, which will let the workflow finish.
191194 ThreadUtils .waitForWorkflow (token + "-finish" );
@@ -241,7 +244,7 @@ public void testFailedActivity() throws InterruptedException {
241244 "Activity was asked to fail on attempt 1" ,
242245 actual .getLastFailure ().getMessage ());
243246
244- PendingActivityInfo expected =
247+ PendingActivityInfo . Builder expected =
245248 PendingActivityInfo .newBuilder ()
246249 .setActivityId (actual .getActivityId ())
247250 .setActivityType (ActivityType .newBuilder ().setName ("TestDescribeActivity" ).build ())
@@ -258,10 +261,13 @@ public void testFailedActivity() throws InterruptedException {
258261 // it.
259262 .setLastWorkerIdentity (actual .getLastWorkerIdentity ())
260263 // 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+ }
263269
264- Assert .assertEquals ("PendingActivityInfo should match" , expected , actual );
270+ Assert .assertEquals ("PendingActivityInfo should match" , expected . build () , actual );
265271
266272 // Now let the workflow succeed
267273 ThreadUtils .waitForWorkflow (token + "-finish" );
0 commit comments