aboutsummaryrefslogtreecommitdiff
path: root/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-testlib/src/com/google/common/testing/ClassSanityTester.java')
-rw-r--r--guava-testlib/src/com/google/common/testing/ClassSanityTester.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java b/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
index d327666fe..e0998f0af 100644
--- a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
+++ b/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
@@ -496,13 +496,14 @@ public final class ClassSanityTester {
* @return this tester
*/
@CanIgnoreReturnValue
+ @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
public FactoryMethodReturnValueTester testSerializable() throws Exception {
for (Invokable<?, ?> factory : getFactoriesToTest()) {
Object instance = instantiate(factory);
if (instance != null) {
try {
SerializableTester.reserialize(instance);
- } catch (RuntimeException e) {
+ } catch (Exception e) { // sneaky checked exception
AssertionError error =
new AssertionFailedError("Serialization failed on return value of " + factory);
error.initCause(e.getCause());
@@ -522,6 +523,7 @@ public final class ClassSanityTester {
* @return this tester
*/
@CanIgnoreReturnValue
+ @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
public FactoryMethodReturnValueTester testEqualsAndSerializable() throws Exception {
for (Invokable<?, ?> factory : getFactoriesToTest()) {
try {
@@ -533,7 +535,7 @@ public final class ClassSanityTester {
if (instance != null) {
try {
SerializableTester.reserializeAndAssert(instance);
- } catch (RuntimeException e) {
+ } catch (Exception e) { // sneaky checked exception
AssertionError error =
new AssertionFailedError("Serialization failed on return value of " + factory);
error.initCause(e.getCause());