Merge pull request #689 from vbauer/util-classes

Add unit tests for constructors from util classes
This commit is contained in:
Jesse Wilson 2015-08-14 20:42:31 -04:00
commit 87717662f7
6 changed files with 18 additions and 3 deletions

View File

@ -30,6 +30,10 @@ package com.google.gson.internal;
* @author Joel Leitch
*/
public final class $Gson$Preconditions {
private $Gson$Preconditions() {
throw new UnsupportedOperationException();
}
public static <T> T checkNotNull(T obj) {
if (obj == null) {
throw new NullPointerException();

View File

@ -43,7 +43,9 @@ import java.util.Properties;
public final class $Gson$Types {
static final Type[] EMPTY_TYPE_ARRAY = new Type[] {};
private $Gson$Types() {}
private $Gson$Types() {
throw new UnsupportedOperationException();
}
/**
* Returns a new parameterized type, applying {@code typeArguments} to

View File

@ -29,7 +29,9 @@ import java.util.Map;
* @author Kevin Bourrillion
*/
public final class Primitives {
private Primitives() {}
private Primitives() {
throw new UnsupportedOperationException();
}
/** A map from primitive types to their corresponding wrapper types. */
private static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPER_TYPE;

View File

@ -33,6 +33,10 @@ import java.io.Writer;
* Reads and writes GSON parse trees over streams.
*/
public final class Streams {
private Streams() {
throw new UnsupportedOperationException();
}
/**
* Takes a reader in any state and returns the next value as a JsonElement.
*/

View File

@ -55,7 +55,9 @@ import com.google.gson.stream.JsonWriter;
* Type adapters for basic types.
*/
public final class TypeAdapters {
private TypeAdapters() {}
private TypeAdapters() {
throw new UnsupportedOperationException();
}
@SuppressWarnings("rawtypes")
public static final TypeAdapter<Class> CLASS = new TypeAdapter<Class>() {

View File

@ -69,4 +69,5 @@ public class MoreAsserts {
Assert.assertFalse(a.equals(null));
Assert.assertFalse(a.equals(new Object()));
}
}