Skip to content

Commit

Permalink
spotless formatting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
progaslcas committed Dec 3, 2024
1 parent e1cb486 commit 12d07ac
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions gson/src/test/java/com/google/gson/stream/JsonReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import com.google.gson.Strictness;
import com.google.gson.internal.bind.TypeAdapters;

import java.io.EOFException;
import java.io.IOException;
import java.io.Reader;
Expand All @@ -39,7 +38,6 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.Stream;

import org.junit.Ignore;
import org.junit.Test;

Expand Down Expand Up @@ -2195,25 +2193,25 @@ private static Reader reader(String s) {
}
}; */
}
@Test
public void testJsonReaderWithStrictnessSetToLenientAndNullValue() throws IOException {
Iterator<String> iterator = Stream.of(null, "value1", "value2").iterator();
StringWriter str = new StringWriter();

try (JsonWriter writer = new JsonWriter(str)) {
writer.setStrictness(Strictness.LENIENT);
while (iterator.hasNext()) {
TypeAdapters.STRING.write(writer, iterator.next());
}
writer.flush();
}

JsonReader reader = new JsonReader(new StringReader(str.toString()));
reader.setStrictness(Strictness.LENIENT);

assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("null");
assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("value1");
assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("value2");
}

@Test
public void testJsonReaderWithStrictnessSetToLenientAndNullValue() throws IOException {
Iterator<String> iterator = Stream.of(null, "value1", "value2").iterator();
StringWriter str = new StringWriter();

try (JsonWriter writer = new JsonWriter(str)) {
writer.setStrictness(Strictness.LENIENT);
while (iterator.hasNext()) {
TypeAdapters.STRING.write(writer, iterator.next());
}
writer.flush();
}

JsonReader reader = new JsonReader(new StringReader(str.toString()));
reader.setStrictness(Strictness.LENIENT);

assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("null");
assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("value1");
assertThat(TypeAdapters.STRING.read(reader)).isEqualTo("value2");
}
}

0 comments on commit 12d07ac

Please sign in to comment.