Skip to content

Commit bd0fd2d

Browse files
committed
5
1 parent 9920d5e commit bd0fd2d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

util/src/test/java/io/grpc/util/GracefulSwitchLoadBalancerTest.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static io.grpc.ConnectivityState.READY;
2222
import static io.grpc.ConnectivityState.TRANSIENT_FAILURE;
2323
import static io.grpc.util.GracefulSwitchLoadBalancer.BUFFER_PICKER;
24+
import static org.junit.Assert.assertThrows;
2425
import static org.mockito.ArgumentMatchers.any;
2526
import static org.mockito.ArgumentMatchers.eq;
2627
import static org.mockito.Mockito.inOrder;
@@ -52,9 +53,7 @@
5253
import java.util.HashMap;
5354
import java.util.List;
5455
import java.util.Map;
55-
import org.junit.Rule;
5656
import org.junit.Test;
57-
import org.junit.rules.ExpectedException;
5857
import org.junit.runner.RunWith;
5958
import org.junit.runners.JUnit4;
6059
import org.mockito.ArgumentCaptor;
@@ -67,10 +66,6 @@
6766
public class GracefulSwitchLoadBalancerTest {
6867
private static final Object FAKE_CONFIG = new Object();
6968

70-
@SuppressWarnings("deprecation") // https://github.com/grpc/grpc-java/issues/7467
71-
@Rule
72-
public final ExpectedException thrown = ExpectedException.none();
73-
7469
private final Map<LoadBalancerProvider, LoadBalancer> balancers = new HashMap<>();
7570
private final Map<LoadBalancer, Helper> helpers = new HashMap<>();
7671
private final Helper mockHelper = mock(Helper.class);
@@ -101,8 +96,8 @@ public void handleSubchannelState_shouldThrow() {
10196
.build()));
10297
Subchannel subchannel = mock(Subchannel.class);
10398
ConnectivityStateInfo connectivityStateInfo = ConnectivityStateInfo.forNonError(READY);
104-
thrown.expect(UnsupportedOperationException.class);
105-
gracefulSwitchLb.handleSubchannelState(subchannel, connectivityStateInfo);
99+
assertThrows(UnsupportedOperationException.class,
100+
() -> gracefulSwitchLb.handleSubchannelState(subchannel, connectivityStateInfo));
106101
}
107102

108103
@Test

0 commit comments

Comments
 (0)