2020import static io .grpc .ConnectivityState .CONNECTING ;
2121import static io .grpc .ConnectivityState .READY ;
2222import static io .grpc .ConnectivityState .TRANSIENT_FAILURE ;
23- import static io .grpc .LoadBalancer . EMPTY_PICKER ;
23+ import static io .grpc .LoadBalancerMatchers . pickerReturns ;
2424import static org .mockito .ArgumentMatchers .any ;
2525import static org .mockito .ArgumentMatchers .eq ;
2626import static org .mockito .Mockito .atLeast ;
@@ -209,7 +209,7 @@ public void handleResolvedAddresses() {
209209 .setAttributes (Attributes .newBuilder ().set (fakeKey , fakeValue ).build ())
210210 .setLoadBalancingPolicyConfig (new WeightedTargetConfig (targets ))
211211 .build ());
212- verify (helper ).updateBalancingState (eq (CONNECTING ), eq ( EMPTY_PICKER ));
212+ verify (helper ).updateBalancingState (eq (CONNECTING ), pickerReturns ( PickResult . withNoResult () ));
213213 assertThat (childBalancers ).hasSize (4 );
214214 assertThat (childHelpers ).hasSize (4 );
215215 assertThat (fooLbCreated ).isEqualTo (2 );
@@ -246,7 +246,8 @@ public void handleResolvedAddresses() {
246246 .setAddresses (ImmutableList .<EquivalentAddressGroup >of ())
247247 .setLoadBalancingPolicyConfig (new WeightedTargetConfig (newTargets ))
248248 .build ());
249- verify (helper , atLeast (2 )).updateBalancingState (eq (CONNECTING ), eq (EMPTY_PICKER ));
249+ verify (helper , atLeast (2 ))
250+ .updateBalancingState (eq (CONNECTING ), pickerReturns (PickResult .withNoResult ()));
250251 assertThat (childBalancers ).hasSize (5 );
251252 assertThat (childHelpers ).hasSize (5 );
252253 assertThat (fooLbCreated ).isEqualTo (3 ); // One more foo LB created for target4
@@ -288,7 +289,7 @@ public void handleNameResolutionError() {
288289 .setAddresses (ImmutableList .<EquivalentAddressGroup >of ())
289290 .setLoadBalancingPolicyConfig (new WeightedTargetConfig (targets ))
290291 .build ());
291- verify (helper ).updateBalancingState (eq (CONNECTING ), eq ( EMPTY_PICKER ));
292+ verify (helper ).updateBalancingState (eq (CONNECTING ), pickerReturns ( PickResult . withNoResult () ));
292293
293294 // Error after child balancers created.
294295 weightedTargetLb .handleNameResolutionError (Status .ABORTED );
@@ -315,7 +316,7 @@ public void balancingStateUpdatedFromChildBalancers() {
315316 .setAddresses (ImmutableList .<EquivalentAddressGroup >of ())
316317 .setLoadBalancingPolicyConfig (new WeightedTargetConfig (targets ))
317318 .build ());
318- verify (helper ).updateBalancingState (eq (CONNECTING ), eq ( EMPTY_PICKER ));
319+ verify (helper ).updateBalancingState (eq (CONNECTING ), pickerReturns ( PickResult . withNoResult () ));
319320
320321 // Subchannels to be created for each child balancer.
321322 final SubchannelPicker [] subchannelPickers = new SubchannelPicker []{
@@ -335,7 +336,8 @@ public void balancingStateUpdatedFromChildBalancers() {
335336 childHelpers .get (1 ).updateBalancingState (TRANSIENT_FAILURE , failurePickers [1 ]);
336337 verify (helper , never ()).updateBalancingState (
337338 eq (TRANSIENT_FAILURE ), any (SubchannelPicker .class ));
338- verify (helper , times (2 )).updateBalancingState (eq (CONNECTING ), eq (EMPTY_PICKER ));
339+ verify (helper , times (2 ))
340+ .updateBalancingState (eq (CONNECTING ), pickerReturns (PickResult .withNoResult ()));
339341
340342 // Another child balancer goes to READY.
341343 childHelpers .get (2 ).updateBalancingState (READY , subchannelPickers [2 ]);
@@ -396,7 +398,7 @@ public void raceBetweenShutdownAndChildLbBalancingStateUpdate() {
396398 .setAddresses (ImmutableList .<EquivalentAddressGroup >of ())
397399 .setLoadBalancingPolicyConfig (new WeightedTargetConfig (targets ))
398400 .build ());
399- verify (helper ).updateBalancingState (eq (CONNECTING ), eq ( EMPTY_PICKER ));
401+ verify (helper ).updateBalancingState (eq (CONNECTING ), pickerReturns ( PickResult . withNoResult () ));
400402
401403 // LB shutdown and subchannel state change can happen simultaneously. If shutdown runs first,
402404 // any further balancing state update should be ignored.
0 commit comments