Skip to content

Commit 8771766

Browse files
committed
Merge pull request google#689 from vbauer/util-classes
Add unit tests for constructors from util classes
2 parents 6cd5ee6 + eb79ec7 commit 8771766

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

gson/src/main/java/com/google/gson/internal/$Gson$Preconditions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
* @author Joel Leitch
3131
*/
3232
public final class $Gson$Preconditions {
33+
private $Gson$Preconditions() {
34+
throw new UnsupportedOperationException();
35+
}
36+
3337
public static <T> T checkNotNull(T obj) {
3438
if (obj == null) {
3539
throw new NullPointerException();

gson/src/main/java/com/google/gson/internal/$Gson$Types.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
public final class $Gson$Types {
4444
static final Type[] EMPTY_TYPE_ARRAY = new Type[] {};
4545

46-
private $Gson$Types() {}
46+
private $Gson$Types() {
47+
throw new UnsupportedOperationException();
48+
}
4749

4850
/**
4951
* Returns a new parameterized type, applying {@code typeArguments} to

gson/src/main/java/com/google/gson/internal/Primitives.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
* @author Kevin Bourrillion
3030
*/
3131
public final class Primitives {
32-
private Primitives() {}
32+
private Primitives() {
33+
throw new UnsupportedOperationException();
34+
}
3335

3436
/** A map from primitive types to their corresponding wrapper types. */
3537
private static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPER_TYPE;

gson/src/main/java/com/google/gson/internal/Streams.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
* Reads and writes GSON parse trees over streams.
3434
*/
3535
public final class Streams {
36+
private Streams() {
37+
throw new UnsupportedOperationException();
38+
}
39+
3640
/**
3741
* Takes a reader in any state and returns the next value as a JsonElement.
3842
*/

gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
* Type adapters for basic types.
5656
*/
5757
public final class TypeAdapters {
58-
private TypeAdapters() {}
58+
private TypeAdapters() {
59+
throw new UnsupportedOperationException();
60+
}
5961

6062
@SuppressWarnings("rawtypes")
6163
public static final TypeAdapter<Class> CLASS = new TypeAdapter<Class>() {

gson/src/test/java/com/google/gson/common/MoreAsserts.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ public static void assertEqualsAndHashCode(Object a, Object b) {
6969
Assert.assertFalse(a.equals(null));
7070
Assert.assertFalse(a.equals(new Object()));
7171
}
72+
7273
}

0 commit comments

Comments
 (0)