Skip to content

Commit 05151ff

Browse files
committed
change StatusRuntimeException to StatusException in catch blocks
1 parent 53a0766 commit 05151ff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stub/src/test/java/io/grpc/stub/BlockingClientCallTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import io.grpc.ServiceDescriptor;
3535
import io.grpc.Status;
3636
import io.grpc.Status.Code;
37-
import io.grpc.StatusRuntimeException;
37+
import io.grpc.StatusException;
3838
import io.grpc.inprocess.InProcessChannelBuilder;
3939
import io.grpc.inprocess.InProcessServerBuilder;
4040
import io.grpc.stub.ServerCalls.BidiStreamingMethod;
@@ -190,7 +190,7 @@ public void testCancel() throws Exception {
190190
try {
191191
assertNull(biDiStream.read(2 * DELAY_MILLIS, TimeUnit.MILLISECONDS));
192192
fail("No exception thrown by read after cancel");
193-
} catch (StatusRuntimeException e) {
193+
} catch (StatusException e) {
194194
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
195195
assertThat(System.currentTimeMillis() - start).isLessThan(2 * DELAY_MILLIS);
196196
}
@@ -205,7 +205,7 @@ public void testCancel() throws Exception {
205205
try {
206206
assertFalse(biDiStream.write(30)); // this is interrupted by cancel
207207
fail("No exception thrown when write was interrupted by cancel");
208-
} catch (StatusRuntimeException e) {
208+
} catch (StatusException e) {
209209
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
210210
}
211211

@@ -223,7 +223,7 @@ public void testCancel() throws Exception {
223223
try {
224224
start = System.currentTimeMillis();
225225
assertNull(biDiStream.read(2, TimeUnit.SECONDS));
226-
} catch (StatusRuntimeException e) {
226+
} catch (StatusException e) {
227227
assertEquals(Status.CANCELLED.getCode(), e.getStatus().getCode());
228228
assertThat(System.currentTimeMillis() - start).isLessThan(200);
229229
}
@@ -385,7 +385,7 @@ public void testWriteCompleted() throws Exception {
385385
}
386386

387387
@Test
388-
public void testClose_withException() throws InterruptedException {
388+
public void testClose_withException() throws Exception {
389389
biDiStream = ClientCalls.blockingBidiStreamingCall(channel, BIDI_STREAMING_METHOD,
390390
CallOptions.DEFAULT);
391391

@@ -397,7 +397,7 @@ public void testClose_withException() throws InterruptedException {
397397
assertEquals(descr, closedStatus.getDescription());
398398
try {
399399
assertFalse(biDiStream.write(1));
400-
} catch (StatusRuntimeException e) {
400+
} catch (StatusException e) {
401401
assertThat(e.getMessage()).startsWith("FAILED_PRECONDITION");
402402
}
403403
}

0 commit comments

Comments
 (0)