Add missing calls when testing for exceptions. (#1948)
This commit is contained in:
parent
1a2e58a42f
commit
c8f26dc907
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user