|
21 | 21 | import static io.grpc.ConnectivityState.READY; |
22 | 22 | import static io.grpc.ConnectivityState.TRANSIENT_FAILURE; |
23 | 23 | import static io.grpc.util.GracefulSwitchLoadBalancer.BUFFER_PICKER; |
| 24 | +import static org.junit.Assert.assertThrows; |
24 | 25 | import static org.mockito.ArgumentMatchers.any; |
25 | 26 | import static org.mockito.ArgumentMatchers.eq; |
26 | 27 | import static org.mockito.Mockito.inOrder; |
|
52 | 53 | import java.util.HashMap; |
53 | 54 | import java.util.List; |
54 | 55 | import java.util.Map; |
55 | | -import org.junit.Rule; |
56 | 56 | import org.junit.Test; |
57 | | -import org.junit.rules.ExpectedException; |
58 | 57 | import org.junit.runner.RunWith; |
59 | 58 | import org.junit.runners.JUnit4; |
60 | 59 | import org.mockito.ArgumentCaptor; |
|
67 | 66 | public class GracefulSwitchLoadBalancerTest { |
68 | 67 | private static final Object FAKE_CONFIG = new Object(); |
69 | 68 |
|
70 | | - @SuppressWarnings("deprecation") // https://github.com/grpc/grpc-java/issues/7467 |
71 | | - @Rule |
72 | | - public final ExpectedException thrown = ExpectedException.none(); |
73 | | - |
74 | 69 | private final Map<LoadBalancerProvider, LoadBalancer> balancers = new HashMap<>(); |
75 | 70 | private final Map<LoadBalancer, Helper> helpers = new HashMap<>(); |
76 | 71 | private final Helper mockHelper = mock(Helper.class); |
@@ -101,8 +96,8 @@ public void handleSubchannelState_shouldThrow() { |
101 | 96 | .build())); |
102 | 97 | Subchannel subchannel = mock(Subchannel.class); |
103 | 98 | ConnectivityStateInfo connectivityStateInfo = ConnectivityStateInfo.forNonError(READY); |
104 | | - thrown.expect(UnsupportedOperationException.class); |
105 | | - gracefulSwitchLb.handleSubchannelState(subchannel, connectivityStateInfo); |
| 99 | + assertThrows(UnsupportedOperationException.class, |
| 100 | + () -> gracefulSwitchLb.handleSubchannelState(subchannel, connectivityStateInfo)); |
106 | 101 | } |
107 | 102 |
|
108 | 103 | @Test |
|
0 commit comments