Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
chore: address feedback comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulKQL committed Feb 27, 2020
1 parent 99b857e commit 9489a08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Expand Up @@ -51,6 +51,7 @@
import com.google.api.gax.rpc.UnknownException;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.UncheckedExecutionException;
import java.util.Set;
import org.junit.After;
import org.junit.Assert;
Expand Down Expand Up @@ -278,7 +279,7 @@ public void retryKeepFailing() {
try {
Futures.getUnchecked(future);
Assert.fail("Callable should have thrown an exception");
} catch (Exception expected) {
} catch (UncheckedExecutionException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(ApiException.class);
assertThat(expected).hasCauseThat().hasMessageThat().contains("Unavailable");
}
Expand Down
Expand Up @@ -37,6 +37,7 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.UncheckedExecutionException;
import java.io.IOException;
import java.util.concurrent.Executors;
import org.junit.Assert;
Expand Down Expand Up @@ -71,7 +72,7 @@ public void throwsIOException() {
ApiExceptions.callAndTranslateApiException(
ApiFutures.immediateFailedFuture(new IOException()));
Assert.fail("ApiExceptions should have thrown an exception");
} catch (Exception expected) {
} catch (UncheckedExecutionException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(IOException.class);
}
}
Expand All @@ -82,7 +83,7 @@ public void throwsRuntimeException() {
ApiExceptions.callAndTranslateApiException(
ApiFutures.immediateFailedFuture(new IllegalArgumentException()));
Assert.fail("ApiExceptions should have thrown an exception");
} catch (Exception expected) {
} catch (IllegalArgumentException expected) {
assertThat(expected).isInstanceOf(IllegalArgumentException.class);
}
}
Expand Down
5 changes: 3 additions & 2 deletions gax/src/test/java/com/google/api/gax/rpc/RetryingTest.java
Expand Up @@ -44,6 +44,7 @@
import com.google.api.gax.rpc.testing.FakeTransportChannel;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.UncheckedExecutionException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -236,7 +237,7 @@ public void retryKeepFailing() {
try {
Futures.getUnchecked(future);
Assert.fail("Callable should have thrown an exception");
} catch (Exception expected) {
} catch (UncheckedExecutionException expected) {
assertThat(expected).hasCauseThat().isSameInstanceAs(throwable);
}
}
Expand Down Expand Up @@ -277,7 +278,7 @@ public void testUnknownStatusCode() {
try {
callable.call(1);
Assert.fail("Callable should have thrown an exception");
} catch (Exception expected) {
} catch (RuntimeException expected) {
assertThat(expected).isInstanceOf(RuntimeException.class);
}
}
Expand Down

0 comments on commit 9489a08

Please sign in to comment.