diff --git a/astah/JSON.asta b/astah/JSON.asta index fedf9e8..c37dfe7 100644 Binary files a/astah/JSON.asta and b/astah/JSON.asta differ diff --git a/src/main/java/io/github/azige/json/JsonWriterImpl.java b/src/main/java/io/github/azige/json/JsonWriterImpl.java index d51e5af..8762de3 100644 --- a/src/main/java/io/github/azige/json/JsonWriterImpl.java +++ b/src/main/java/io/github/azige/json/JsonWriterImpl.java @@ -15,7 +15,6 @@ */ package io.github.azige.json; -import static javax.management.Query.value; import java.io.Writer; import java.util.Map.Entry; diff --git a/src/test/java/io/github/azige/json/JsonGeneratorImplTest.java b/src/test/java/io/github/azige/json/JsonGeneratorImplTest.java index b93caf4..4a6ba52 100644 --- a/src/test/java/io/github/azige/json/JsonGeneratorImplTest.java +++ b/src/test/java/io/github/azige/json/JsonGeneratorImplTest.java @@ -26,6 +26,7 @@ import java.io.StringWriter; import java.util.Arrays; +import javax.json.stream.JsonGenerator; /** * @@ -71,7 +72,7 @@ public void testSomeMethod(){ @Test public void testFormat(){ StringWriter sw = new StringWriter(); - JsonGeneratorImpl generator = new JsonGeneratorImpl(sw, true); + JsonGenerator generator = new JsonGeneratorImpl(sw, true); generator .writeStartObject() .write("firstName", "John") @@ -96,7 +97,28 @@ public void testFormat(){ .writeEnd() .close(); - System.out.println(sw.toString()); + String expect = "{\n" + + " \"firstName\": \"John\",\n" + + " \"lastName\": \"Smith\",\n" + + " \"age\": 25,\n" + + " \"address\": {\n" + + " \"streetAddress\": \"21 2nd Street\",\n" + + " \"city\": \"New York\",\n" + + " \"state\": \"NY\",\n" + + " \"postalCode\": \"10021\"\n" + + " },\n" + + " \"phoneNumber\": [\n" + + " {\n" + + " \"type\": \"home\",\n" + + " \"number\": \"212 555-1234\"\n" + + " },\n" + + " {\n" + + " \"type\": \"fax\",\n" + + " \"number\": \"646 555-4567\"\n" + + " }\n" + + " ]\n" + + "}"; + assertEquals(expect, sw.toString()); } @Test