From c8f26dc907515b40dd2ddb471ee1d6cc097d0e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 31 Aug 2021 15:03:45 -0700 Subject: [PATCH] Add missing calls when testing for exceptions. (#1948) --- .../google/gson/functional/DefaultTypeAdaptersTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java b/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java index e2c2b02e..f81537f5 100644 --- a/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java +++ b/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java @@ -90,7 +90,9 @@ public class DefaultTypeAdaptersTest extends TestCase { public void testClassSerialization() { try { gson.toJson(String.class); - } catch (UnsupportedOperationException expected) {} + fail(); + } catch (UnsupportedOperationException expected) { + } // Override with a custom type adapter for class. gson = new GsonBuilder().registerTypeAdapter(Class.class, new MyClassTypeAdapter()).create(); assertEquals("\"java.lang.String\"", gson.toJson(String.class)); @@ -99,7 +101,9 @@ public class DefaultTypeAdaptersTest extends TestCase { public void testClassDeserialization() { try { gson.fromJson("String.class", String.class.getClass()); - } catch (UnsupportedOperationException expected) {} + fail(); + } catch (UnsupportedOperationException expected) { + } // Override with a custom type adapter for class. gson = new GsonBuilder().registerTypeAdapter(Class.class, new MyClassTypeAdapter()).create(); assertEquals(String.class, gson.fromJson("java.lang.String", Class.class));