Address review comments from @Marcono1234. (#2372)
This commit is contained in:
parent
c1da2d7070
commit
37ed0fcbd7
|
@ -129,6 +129,7 @@ public final class GraphAdapterBuilderTest {
|
|||
@Test
|
||||
public void testSerializationWithMultipleTypes() {
|
||||
Company google = new Company("Google");
|
||||
// Employee constructor adds `this` to the given Company object
|
||||
Employee unused1 = new Employee("Jesse", google);
|
||||
Employee unused2 = new Employee("Joel", google);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public abstract class JsonElement {
|
|||
* @throws IllegalStateException if this element is of another type.
|
||||
* @since 1.2
|
||||
*/
|
||||
@CanIgnoreReturnValue
|
||||
@CanIgnoreReturnValue // When this method is used only to verify that the value is JsonNull
|
||||
public JsonNull getAsJsonNull() {
|
||||
if (isJsonNull()) {
|
||||
return (JsonNull) this;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.google.gson;
|
||||
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
|
|
|
@ -124,11 +124,11 @@ public class DefaultTypeAdaptersTest {
|
|||
public void testUrlDeserialization() {
|
||||
String urlValue = "http://google.com/";
|
||||
String json = "'http:\\/\\/google.com\\/'";
|
||||
URL target = gson.fromJson(json, URL.class);
|
||||
assertThat(target.toExternalForm()).isEqualTo(urlValue);
|
||||
URL target1 = gson.fromJson(json, URL.class);
|
||||
assertThat(target1.toExternalForm()).isEqualTo(urlValue);
|
||||
|
||||
URL unused = gson.fromJson('"' + urlValue + '"', URL.class);
|
||||
assertThat(target.toExternalForm()).isEqualTo(urlValue);
|
||||
URL target2 = gson.fromJson('"' + urlValue + '"', URL.class);
|
||||
assertThat(target2.toExternalForm()).isEqualTo(urlValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue