diff options
author | Krzysztof KosiĆski <krzysio@google.com> | 2023-09-29 04:03:50 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-09-29 04:03:50 +0000 |
commit | daa3a34259dc9401733a24dcf979fdc36fded516 (patch) | |
tree | 9a749191ce2e5f44f08ff1a386573b5ee1a6fc37 /gson/src/test/java/com/google/gson/FieldAttributesTest.java | |
parent | df0635d076c8cb792e076c1cf5c96dceed4759c5 (diff) | |
parent | a9ba688cdc8d670f6016bd305a6e8937e57739b5 (diff) | |
download | gson-daa3a34259dc9401733a24dcf979fdc36fded516.tar.gz |
Upgrade Gson to version 2.10.1. am: b2558080ce am: 50e7cd1834 am: a9ba688cdc
Original change: https://android-review.googlesource.com/c/platform/external/gson/+/2768685
Change-Id: I7201c2b6e326759fa87e01298feef4575c2166fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'gson/src/test/java/com/google/gson/FieldAttributesTest.java')
-rw-r--r-- | gson/src/test/java/com/google/gson/FieldAttributesTest.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gson/src/test/java/com/google/gson/FieldAttributesTest.java b/gson/src/test/java/com/google/gson/FieldAttributesTest.java index 31be3e28..2cc362d2 100644 --- a/gson/src/test/java/com/google/gson/FieldAttributesTest.java +++ b/gson/src/test/java/com/google/gson/FieldAttributesTest.java @@ -16,11 +16,17 @@ package com.google.gson; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import com.google.gson.reflect.TypeToken; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.List; -import junit.framework.TestCase; +import org.junit.Before; +import org.junit.Test; /** * Unit tests for the {@link FieldAttributes} class. @@ -28,16 +34,16 @@ import junit.framework.TestCase; * @author Inderjeet Singh * @author Joel Leitch */ -public class FieldAttributesTest extends TestCase { +public class FieldAttributesTest { private FieldAttributes fieldAttributes; - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { fieldAttributes = new FieldAttributes(Foo.class.getField("bar")); } @SuppressWarnings("unused") + @Test public void testNullField() throws Exception { try { new FieldAttributes(null); @@ -45,10 +51,12 @@ public class FieldAttributesTest extends TestCase { } catch (NullPointerException expected) { } } + @Test public void testDeclaringClass() throws Exception { assertEquals(Foo.class, fieldAttributes.getDeclaringClass()); } + @Test public void testModifiers() throws Exception { assertFalse(fieldAttributes.hasModifier(Modifier.STATIC)); assertFalse(fieldAttributes.hasModifier(Modifier.FINAL)); @@ -60,10 +68,12 @@ public class FieldAttributesTest extends TestCase { assertTrue(fieldAttributes.hasModifier(Modifier.TRANSIENT)); } + @Test public void testName() throws Exception { assertEquals("bar", fieldAttributes.getName()); } + @Test public void testDeclaredTypeAndClass() throws Exception { Type expectedType = new TypeToken<List<String>>() {}.getType(); assertEquals(expectedType, fieldAttributes.getDeclaredType()); |