Skip to content

Commit

Permalink
Edit test
Browse files Browse the repository at this point in the history
  • Loading branch information
azige committed Jun 7, 2014
1 parent 18ce8a8 commit 426dcf4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Binary file modified astah/JSON.asta
Binary file not shown.
1 change: 0 additions & 1 deletion src/main/java/io/github/azige/json/JsonWriterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.github.azige.json;

import static javax.management.Query.value;

import java.io.Writer;
import java.util.Map.Entry;
Expand Down
26 changes: 24 additions & 2 deletions src/test/java/io/github/azige/json/JsonGeneratorImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.StringWriter;
import java.util.Arrays;

import javax.json.stream.JsonGenerator;

/**
*
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 426dcf4

Please sign in to comment.