aboutsummaryrefslogtreecommitdiff
path: root/gson/src/test/java/com/google/gson/functional/InterfaceTest.java
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-09-30 03:08:18 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-09-30 03:08:18 +0000
commit2b3105d7c93244933dd77b79b5868227458182be (patch)
tree9a749191ce2e5f44f08ff1a386573b5ee1a6fc37 /gson/src/test/java/com/google/gson/functional/InterfaceTest.java
parentdf0635d076c8cb792e076c1cf5c96dceed4759c5 (diff)
parentaedc70d3d9bd54f6d7511d3be9dd8de5a6ccf77e (diff)
downloadgson-2b3105d7c93244933dd77b79b5868227458182be.tar.gz
Change-Id: I8f02bf76dbfc34aaaae464ccd2768275adfe5bbb
Diffstat (limited to 'gson/src/test/java/com/google/gson/functional/InterfaceTest.java')
-rw-r--r--gson/src/test/java/com/google/gson/functional/InterfaceTest.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/gson/src/test/java/com/google/gson/functional/InterfaceTest.java b/gson/src/test/java/com/google/gson/functional/InterfaceTest.java
index 6851f1e9..e94885d8 100644
--- a/gson/src/test/java/com/google/gson/functional/InterfaceTest.java
+++ b/gson/src/test/java/com/google/gson/functional/InterfaceTest.java
@@ -16,9 +16,11 @@
package com.google.gson.functional;
-import com.google.gson.Gson;
+import static org.junit.Assert.assertEquals;
-import junit.framework.TestCase;
+import com.google.gson.Gson;
+import org.junit.Before;
+import org.junit.Test;
/**
* Functional tests involving interfaces.
@@ -26,23 +28,24 @@ import junit.framework.TestCase;
* @author Inderjeet Singh
* @author Joel Leitch
*/
-public class InterfaceTest extends TestCase {
+public class InterfaceTest {
private static final String OBJ_JSON = "{\"someStringValue\":\"StringValue\"}";
private Gson gson;
private TestObject obj;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
gson = new Gson();
obj = new TestObject("StringValue");
}
+ @Test
public void testSerializingObjectImplementingInterface() throws Exception {
assertEquals(OBJ_JSON, gson.toJson(obj));
}
+ @Test
public void testSerializingInterfaceObjectField() throws Exception {
TestObjectWrapper objWrapper = new TestObjectWrapper(obj);
assertEquals("{\"obj\":" + OBJ_JSON + "}", gson.toJson(objWrapper));