-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DO NOT MERGE] Test for google/gson#2729
- Loading branch information
1 parent
0d210f5
commit 8aaac03
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.google.gson; | ||
|
||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public final class TypeAdapterTest { | ||
|
||
@Test | ||
public void testTypeAdapterNullSafe() { | ||
final TypeAdapter<?> unit = typeAdapter; | ||
final TypeAdapter<?> nullSafeUnit1 = unit.nullSafe(); | ||
final TypeAdapter<?> nullSafeUnit2 = unit.nullSafe(); | ||
Assertions.assertNotSame(nullSafeUnit1, nullSafeUnit2); | ||
Assertions.assertSame(nullSafeUnit1, nullSafeUnit2.nullSafe(), () -> String.format("Must pass the test once %s is resolved", "https://github.com/google/gson/issues/2729")); | ||
Assertions.assertSame(nullSafeUnit1.nullSafe(), nullSafeUnit2, () -> String.format("Must pass the test once %s is resolved", "https://github.com/google/gson/issues/2729")); | ||
} | ||
|
||
private static final TypeAdapter<Object> typeAdapter = new TypeAdapter<>() { | ||
@Override | ||
public void write(final JsonWriter out, final Object value) { | ||
throw new AssertionError(); | ||
} | ||
|
||
@Override | ||
public Object read(final JsonReader in) { | ||
throw new AssertionError(); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@Nonnull | ||
package com.google.gson; | ||
|
||
import javax.annotation.Nonnull; |