Minor cleanups in deprecations and other warnings (#1522)

This commit is contained in:
Degubi 2019-10-04 00:49:25 +02:00 committed by inder123
parent 0e90771e45
commit 7845c38077
17 changed files with 61 additions and 81 deletions

View File

@ -167,6 +167,7 @@ public class DefaultDateTypeAdapterTest extends TestCase {
assertEquals(toLiteral(formatter.format(currentDate)), dateString); assertEquals(toLiteral(formatter.format(currentDate)), dateString);
} }
@SuppressWarnings("unused")
public void testInvalidDatePattern() throws Exception { public void testInvalidDatePattern() throws Exception {
try { try {
new DefaultDateTypeAdapter(Date.class, "I am a bad Date pattern...."); new DefaultDateTypeAdapter(Date.class, "I am a bad Date pattern....");

View File

@ -39,6 +39,7 @@ public class FieldAttributesTest extends TestCase {
fieldAttributes = new FieldAttributes(Foo.class.getField("bar")); fieldAttributes = new FieldAttributes(Foo.class.getField("bar"));
} }
@SuppressWarnings("unused")
public void testNullField() throws Exception { public void testNullField() throws Exception {
try { try {
new FieldAttributes(null); new FieldAttributes(null);

View File

@ -30,6 +30,7 @@ import java.math.BigInteger;
*/ */
public class JsonPrimitiveTest extends TestCase { public class JsonPrimitiveTest extends TestCase {
@SuppressWarnings("unused")
public void testNulls() { public void testNulls() {
try { try {
new JsonPrimitive((Boolean) null); new JsonPrimitive((Boolean) null);
@ -113,8 +114,8 @@ public class JsonPrimitiveTest extends TestCase {
JsonPrimitive json = new JsonPrimitive("1E+7"); JsonPrimitive json = new JsonPrimitive("1E+7");
assertEquals(new BigDecimal("1E+7"), json.getAsBigDecimal()); assertEquals(new BigDecimal("1E+7"), json.getAsBigDecimal());
assertEquals(new Double("1E+7"), json.getAsDouble(), 0.00001); assertEquals(1E+7, json.getAsDouble(), 0.00001);
assertEquals(new Float("1E+7"), json.getAsDouble(), 0.00001); assertEquals(1E+7, json.getAsDouble(), 0.00001);
try { try {
json.getAsInt(); json.getAsInt();
@ -123,91 +124,91 @@ public class JsonPrimitiveTest extends TestCase {
} }
public void testByteEqualsShort() { public void testByteEqualsShort() {
JsonPrimitive p1 = new JsonPrimitive(new Byte((byte)10)); JsonPrimitive p1 = new JsonPrimitive(Byte.valueOf((byte)10));
JsonPrimitive p2 = new JsonPrimitive(new Short((short)10)); JsonPrimitive p2 = new JsonPrimitive(Short.valueOf((short)10));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testByteEqualsInteger() { public void testByteEqualsInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Byte((byte)10)); JsonPrimitive p1 = new JsonPrimitive(Byte.valueOf((byte)10));
JsonPrimitive p2 = new JsonPrimitive(new Integer(10)); JsonPrimitive p2 = new JsonPrimitive(Integer.valueOf(10));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testByteEqualsLong() { public void testByteEqualsLong() {
JsonPrimitive p1 = new JsonPrimitive(new Byte((byte)10)); JsonPrimitive p1 = new JsonPrimitive(Byte.valueOf((byte)10));
JsonPrimitive p2 = new JsonPrimitive(new Long(10L)); JsonPrimitive p2 = new JsonPrimitive(Long.valueOf(10L));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testByteEqualsBigInteger() { public void testByteEqualsBigInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Byte((byte)10)); JsonPrimitive p1 = new JsonPrimitive(Byte.valueOf((byte)10));
JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10")); JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testShortEqualsInteger() { public void testShortEqualsInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Short((short)10)); JsonPrimitive p1 = new JsonPrimitive(Short.valueOf((short)10));
JsonPrimitive p2 = new JsonPrimitive(new Integer(10)); JsonPrimitive p2 = new JsonPrimitive(Integer.valueOf(10));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testShortEqualsLong() { public void testShortEqualsLong() {
JsonPrimitive p1 = new JsonPrimitive(new Short((short)10)); JsonPrimitive p1 = new JsonPrimitive(Short.valueOf((short)10));
JsonPrimitive p2 = new JsonPrimitive(new Long(10)); JsonPrimitive p2 = new JsonPrimitive(Long.valueOf(10));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testShortEqualsBigInteger() { public void testShortEqualsBigInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Short((short)10)); JsonPrimitive p1 = new JsonPrimitive(Short.valueOf((short)10));
JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10")); JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testIntegerEqualsLong() { public void testIntegerEqualsLong() {
JsonPrimitive p1 = new JsonPrimitive(new Integer(10)); JsonPrimitive p1 = new JsonPrimitive(Integer.valueOf(10));
JsonPrimitive p2 = new JsonPrimitive(new Long(10L)); JsonPrimitive p2 = new JsonPrimitive(Long.valueOf(10L));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testIntegerEqualsBigInteger() { public void testIntegerEqualsBigInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Integer(10)); JsonPrimitive p1 = new JsonPrimitive(Integer.valueOf(10));
JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10")); JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testLongEqualsBigInteger() { public void testLongEqualsBigInteger() {
JsonPrimitive p1 = new JsonPrimitive(new Long(10L)); JsonPrimitive p1 = new JsonPrimitive(Long.valueOf(10L));
JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10")); JsonPrimitive p2 = new JsonPrimitive(new BigInteger("10"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testFloatEqualsDouble() { public void testFloatEqualsDouble() {
JsonPrimitive p1 = new JsonPrimitive(new Float(10.25F)); JsonPrimitive p1 = new JsonPrimitive(Float.valueOf(10.25F));
JsonPrimitive p2 = new JsonPrimitive(new Double(10.25D)); JsonPrimitive p2 = new JsonPrimitive(Double.valueOf(10.25D));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testFloatEqualsBigDecimal() { public void testFloatEqualsBigDecimal() {
JsonPrimitive p1 = new JsonPrimitive(new Float(10.25F)); JsonPrimitive p1 = new JsonPrimitive(Float.valueOf(10.25F));
JsonPrimitive p2 = new JsonPrimitive(new BigDecimal("10.25")); JsonPrimitive p2 = new JsonPrimitive(new BigDecimal("10.25"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());
} }
public void testDoubleEqualsBigDecimal() { public void testDoubleEqualsBigDecimal() {
JsonPrimitive p1 = new JsonPrimitive(new Double(10.25D)); JsonPrimitive p1 = new JsonPrimitive(Double.valueOf(10.25D));
JsonPrimitive p2 = new JsonPrimitive(new BigDecimal("10.25")); JsonPrimitive p2 = new JsonPrimitive(new BigDecimal("10.25"));
assertEquals(p1, p2); assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode()); assertEquals(p1.hashCode(), p2.hashCode());

View File

@ -16,7 +16,7 @@
package com.google.gson.common; package com.google.gson.common;
import junit.framework.Assert; import org.junit.Assert;
import java.util.Collection; import java.util.Collection;
@ -28,26 +28,6 @@ import java.util.Collection;
*/ */
public class MoreAsserts { public class MoreAsserts {
public static void assertEquals(int[] expected, int[] target) {
if (expected == null) {
Assert.assertNull(target);
}
Assert.assertEquals(expected.length, target.length);
for (int i = 0; i < expected.length; ++i) {
Assert.assertEquals(expected[i], target[i]);
}
}
public static void assertEquals(Integer[] expected, Integer[] target) {
if (expected == null) {
Assert.assertNull(target);
}
Assert.assertEquals(expected.length, target.length);
for (int i = 0; i < expected.length; ++i) {
Assert.assertEquals(expected[i], target[i]);
}
}
/** /**
* Asserts that the specified {@code value} is not present in {@code collection} * Asserts that the specified {@code value} is not present in {@code collection}
* @param collection the collection to look into * @param collection the collection to look into
@ -69,5 +49,4 @@ public class MoreAsserts {
Assert.assertFalse(a.equals(null)); Assert.assertFalse(a.equals(null));
Assert.assertFalse(a.equals(new Object())); Assert.assertFalse(a.equals(new Object()));
} }
} }

View File

@ -19,12 +19,12 @@ package com.google.gson.functional;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.google.gson.common.MoreAsserts;
import com.google.gson.common.TestTypes.BagOfPrimitives; import com.google.gson.common.TestTypes.BagOfPrimitives;
import com.google.gson.common.TestTypes.ClassWithObjects; import com.google.gson.common.TestTypes.ClassWithObjects;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import junit.framework.TestCase; import junit.framework.TestCase;
import static org.junit.Assert.assertArrayEquals;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -53,7 +53,7 @@ public class ArrayTest extends TestCase {
public void testTopLevelArrayOfIntsDeserialization() { public void testTopLevelArrayOfIntsDeserialization() {
int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int[] actual = gson.fromJson("[1,2,3,4,5,6,7,8,9]", int[].class); int[] actual = gson.fromJson("[1,2,3,4,5,6,7,8,9]", int[].class);
MoreAsserts.assertEquals(expected, actual); assertArrayEquals(expected, actual);
} }
public void testInvalidArrayDeserialization() { public void testInvalidArrayDeserialization() {
@ -173,8 +173,8 @@ public class ArrayTest extends TestCase {
Collection<Integer>[] target = gson.fromJson(json, type); Collection<Integer>[] target = gson.fromJson(json, type);
assertEquals(2, target.length); assertEquals(2, target.length);
MoreAsserts.assertEquals(new Integer[] { 1, 2 }, target[0].toArray(new Integer[0])); assertArrayEquals(new Integer[] { 1, 2 }, target[0].toArray(new Integer[0]));
MoreAsserts.assertEquals(new Integer[] { 3, 4 }, target[1].toArray(new Integer[0])); assertArrayEquals(new Integer[] { 3, 4 }, target[1].toArray(new Integer[0]));
} }
public void testArrayOfPrimitivesAsObjectsSerialization() throws Exception { public void testArrayOfPrimitivesAsObjectsSerialization() throws Exception {

View File

@ -42,6 +42,7 @@ import com.google.gson.common.TestTypes.BagOfPrimitives;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import junit.framework.TestCase; import junit.framework.TestCase;
import static org.junit.Assert.assertArrayEquals;
/** /**
* Functional tests for Json serialization and deserialization of collections. * Functional tests for Json serialization and deserialization of collections.
@ -70,7 +71,7 @@ public class CollectionTest extends TestCase {
Type collectionType = new TypeToken<Collection<Integer>>() { }.getType(); Type collectionType = new TypeToken<Collection<Integer>>() { }.getType();
Collection<Integer> target = gson.fromJson(json, collectionType); Collection<Integer> target = gson.fromJson(json, collectionType);
int[] expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int[] expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
MoreAsserts.assertEquals(expected, toIntArray(target)); assertArrayEquals(expected, toIntArray(target));
} }
public void testTopLevelListOfIntegerCollectionsDeserialization() throws Exception { public void testTopLevelListOfIntegerCollectionsDeserialization() throws Exception {
@ -86,7 +87,7 @@ public class CollectionTest extends TestCase {
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
MoreAsserts.assertEquals(expected[i], toIntArray(target.get(i))); assertArrayEquals(expected[i], toIntArray(target.get(i)));
} }
} }

View File

@ -123,9 +123,9 @@ public class JsonParserTest extends TestCase {
public void testExtraCommasInArrays() { public void testExtraCommasInArrays() {
Type type = new TypeToken<List<String>>() {}.getType(); Type type = new TypeToken<List<String>>() {}.getType();
assertEquals(list("a", null, "b", null, null), gson.fromJson("[a,,b,,]", type)); assertEquals(Arrays.asList("a", null, "b", null, null), gson.fromJson("[a,,b,,]", type));
assertEquals(list(null, null), gson.fromJson("[,]", type)); assertEquals(Arrays.asList(null, null), gson.fromJson("[,]", type));
assertEquals(list("a", null), gson.fromJson("[a,]", type)); assertEquals(Arrays.asList("a", null), gson.fromJson("[a,]", type));
} }
public void testExtraCommasInMaps() { public void testExtraCommasInMaps() {
@ -136,8 +136,4 @@ public class JsonParserTest extends TestCase {
} catch (JsonSyntaxException expected) { } catch (JsonSyntaxException expected) {
} }
} }
private <T> List<T> list(T... elements) {
return Arrays.asList(elements);
}
} }

View File

@ -59,8 +59,8 @@ public class MapAsArrayTypeAdapterTest extends TestCase {
.create(); .create();
Map<Number, String> original = new LinkedHashMap<Number, String>(); Map<Number, String> original = new LinkedHashMap<Number, String>();
original.put(new Double(1.0), "a"); original.put(1.0D, "a");
original.put(new Float(1.0), "b"); original.put(1.0F, "b");
try { try {
gson.toJson(original, new TypeToken<Map<Number, String>>() {}.getType()); gson.toJson(original, new TypeToken<Map<Number, String>>() {}.getType());
fail(); // we no longer hash keys at serialization time fail(); // we no longer hash keys at serialization time

View File

@ -364,7 +364,7 @@ public class MapTest extends TestCase {
Type typeOfMap = new TypeToken<Map<String, ? extends Long>>() {}.getType(); Type typeOfMap = new TypeToken<Map<String, ? extends Long>>() {}.getType();
Map<String, ? extends Long> map = gson.fromJson("{\"test\":123}", typeOfMap); Map<String, ? extends Long> map = gson.fromJson("{\"test\":123}", typeOfMap);
assertEquals(1, map.size()); assertEquals(1, map.size());
assertEquals(new Long(123L), map.get("test")); assertEquals(Long.valueOf(123L), map.get("test"));
} }

View File

@ -121,7 +121,7 @@ public class ParameterizedTypesTest extends TestCase {
.registerTypeAdapter(ptStringType, new MyParameterizedTypeAdapter<String>()) .registerTypeAdapter(ptStringType, new MyParameterizedTypeAdapter<String>())
.registerTypeAdapter(ptStringType, new MyParameterizedTypeInstanceCreator<String>("")) .registerTypeAdapter(ptStringType, new MyParameterizedTypeInstanceCreator<String>(""))
.registerTypeAdapter(ptIntegerType, .registerTypeAdapter(ptIntegerType,
new MyParameterizedTypeInstanceCreator<Integer>(new Integer(0))) new MyParameterizedTypeInstanceCreator<Integer>(0))
.create(); .create();
MyParameterizedType<Integer> src = new MyParameterizedType<Integer>(10); MyParameterizedType<Integer> src = new MyParameterizedType<Integer>(10);

View File

@ -144,12 +144,12 @@ public class PrimitiveTest extends TestCase {
public void testNumberDeserialization() { public void testNumberDeserialization() {
String json = "1"; String json = "1";
Number expected = new Integer(json); Number expected = Integer.valueOf(json);
Number actual = gson.fromJson(json, Number.class); Number actual = gson.fromJson(json, Number.class);
assertEquals(expected.intValue(), actual.intValue()); assertEquals(expected.intValue(), actual.intValue());
json = String.valueOf(Long.MAX_VALUE); json = String.valueOf(Long.MAX_VALUE);
expected = new Long(json); expected = Long.valueOf(json);
actual = gson.fromJson(json, Number.class); actual = gson.fromJson(json, Number.class);
assertEquals(expected.longValue(), actual.longValue()); assertEquals(expected.longValue(), actual.longValue());
@ -164,16 +164,16 @@ public class PrimitiveTest extends TestCase {
} }
public void testPrimitiveDoubleAutoboxedSerialization() { public void testPrimitiveDoubleAutoboxedSerialization() {
assertEquals("-122.08234335", gson.toJson(-122.08234335)); assertEquals("-122.08234335", gson.toJson(-122.08234335D));
assertEquals("122.08112002", gson.toJson(new Double(122.08112002))); assertEquals("122.08112002", gson.toJson(122.08112002D));
} }
public void testPrimitiveDoubleAutoboxedDeserialization() { public void testPrimitiveDoubleAutoboxedDeserialization() {
double actual = gson.fromJson("-122.08858585", double.class); double actual = gson.fromJson("-122.08858585", double.class);
assertEquals(-122.08858585, actual); assertEquals(-122.08858585D, actual);
actual = gson.fromJson("122.023900008000", Double.class); actual = gson.fromJson("122.023900008000", Double.class);
assertEquals(122.023900008, actual); assertEquals(122.023900008D, actual);
} }
public void testPrimitiveDoubleAutoboxedInASingleElementArraySerialization() { public void testPrimitiveDoubleAutoboxedInASingleElementArraySerialization() {

View File

@ -157,17 +157,17 @@ public final class JsonTreeWriterTest extends TestCase {
writer.setLenient(false); writer.setLenient(false);
writer.beginArray(); writer.beginArray();
try { try {
writer.value(new Double(Double.NaN)); writer.value(Double.valueOf(Double.NaN));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }
try { try {
writer.value(new Double(Double.NEGATIVE_INFINITY)); writer.value(Double.valueOf(Double.NEGATIVE_INFINITY));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }
try { try {
writer.value(new Double(Double.POSITIVE_INFINITY)); writer.value(Double.valueOf(Double.POSITIVE_INFINITY));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }

View File

@ -34,10 +34,11 @@ import java.lang.ref.WeakReference;
*/ */
public class RecursiveTypesResolveTest extends TestCase { public class RecursiveTypesResolveTest extends TestCase {
@SuppressWarnings("unused")
private static class Foo1<A> { private static class Foo1<A> {
public Foo2<? extends A> foo2; public Foo2<? extends A> foo2;
} }
@SuppressWarnings("unused")
private static class Foo2<B> { private static class Foo2<B> {
public Foo1<? super B> foo1; public Foo1<? super B> foo1;
} }
@ -93,10 +94,12 @@ public class RecursiveTypesResolveTest extends TestCase {
* Tests for recursion while resolving type variables. * Tests for recursion while resolving type variables.
*/ */
@SuppressWarnings("unused")
private static class TestType<X> { private static class TestType<X> {
TestType<? super X> superType; TestType<? super X> superType;
} }
@SuppressWarnings("unused")
private static class TestType2<X, Y> { private static class TestType2<X, Y> {
TestType2<? super Y, ? super X> superReversedType; TestType2<? super Y, ? super X> superReversedType;
} }
@ -111,6 +114,3 @@ public class RecursiveTypesResolveTest extends TestCase {
assertNotNull(adapter); assertNotNull(adapter);
} }
} }

View File

@ -48,14 +48,13 @@ public class JsonAdapterNullSafeTest extends TestCase {
// because we use it to return a null type adapter on a recursive call. // because we use it to return a null type adapter on a recursive call.
private static final ThreadLocal<Boolean> recursiveCall = new ThreadLocal<Boolean>(); private static final ThreadLocal<Boolean> recursiveCall = new ThreadLocal<Boolean>();
@SuppressWarnings({"unchecked", "rawtypes"})
@Override public <T> TypeAdapter<T> create(final Gson gson, TypeToken<T> type) { @Override public <T> TypeAdapter<T> create(final Gson gson, TypeToken<T> type) {
if (type.getRawType() != Device.class || recursiveCall.get() != null) { if (type.getRawType() != Device.class || recursiveCall.get() != null) {
recursiveCall.set(null); // clear for subsequent use recursiveCall.set(null); // clear for subsequent use
return null; return null;
} }
recursiveCall.set(Boolean.TRUE); recursiveCall.set(Boolean.TRUE);
return (TypeAdapter) gson.getDelegateAdapter(this, type); return gson.getDelegateAdapter(this, type);
} }
} }
} }

View File

@ -27,9 +27,10 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import static junit.framework.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
@SuppressWarnings("resource")
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class JsonReaderPathTest { public class JsonReaderPathTest {
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")

View File

@ -189,6 +189,7 @@ public final class JsonReaderTest extends TestCase {
} }
} }
@SuppressWarnings("unused")
public void testNulls() { public void testNulls() {
try { try {
new JsonReader(null); new JsonReader(null);

View File

@ -198,17 +198,17 @@ public final class JsonWriterTest extends TestCase {
JsonWriter jsonWriter = new JsonWriter(stringWriter); JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.beginArray(); jsonWriter.beginArray();
try { try {
jsonWriter.value(new Double(Double.NaN)); jsonWriter.value(Double.valueOf(Double.NaN));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }
try { try {
jsonWriter.value(new Double(Double.NEGATIVE_INFINITY)); jsonWriter.value(Double.valueOf(Double.NEGATIVE_INFINITY));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }
try { try {
jsonWriter.value(new Double(Double.POSITIVE_INFINITY)); jsonWriter.value(Double.valueOf(Double.POSITIVE_INFINITY));
fail(); fail();
} catch (IllegalArgumentException expected) { } catch (IllegalArgumentException expected) {
} }