Commit 7025aaec606db9dd55690390c92e51a69a9a501d

Authored by eishchuk
1 parent 33a6a1e0

Change tests

jsonExample.json 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +{
  2 + "json": [
  3 + "rigid",
  4 + "better for data interchange"
  5 + ],
  6 + "yaml": [
  7 + "slim and flexible",
  8 + "better for configuration"
  9 + ],
  10 + "object": {
  11 + "key": "value",
  12 + "array": [
  13 + {
  14 + "null_value": null
  15 + },
  16 + {
  17 + "boolean": true
  18 + },
  19 + {
  20 + "integer": 1
  21 + }
  22 + ]
  23 + },
  24 + "paragraph": "Blank lines denote paragraph breaks",
  25 + "content": "Or we can auto convert line breaks to save space"
  26 +}
0 27 \ No newline at end of file
... ...
src/test/java/com/ishchuk/antlr/JsonParserUnitTest.java
... ... @@ -238,7 +238,7 @@ public class JsonParserUnitTest {
238 238 " ]\n" +
239 239 " },\n" +
240 240 " \"paragraph\": \"Blank lines denote paragraph breaks\",\n" +
241   - " \"content\": \"Or we can autoconvert line breaks to save space\"\n" +
  241 + " \"content\": \"Or we can auto convert line breaks to save space\"\n" +
242 242 "}";
243 243 JSONgramLexer serverJSONgramLexer = new JSONgramLexer(CharStreams.fromString(line));
244 244 CommonTokenStream tokens = new CommonTokenStream( serverJSONgramLexer );
... ... @@ -249,7 +249,23 @@ public class JsonParserUnitTest {
249 249  
250 250 System.out.println(jsonWalker.getJsonFile().toString());
251 251 System.out.println(jsonWalker.convertToYml());
252   - assertTrue(!jsonWalker.convertToYml().isEmpty());
  252 +
  253 + String finalYml = "---\n" +
  254 + "\"yaml\": \n" +
  255 + " - \"slim and flexible\"\n" +
  256 + " - \"better for configuration\"\n" +
  257 + "\"json\": \n" +
  258 + " - \"rigid\"\n" +
  259 + " - \"better for data interchange\"\n" +
  260 + "\"object\": \n" +
  261 + " \"key\": \"value\"\n" +
  262 + " \"array\": \n" +
  263 + " - \"null_value\": null\n" +
  264 + " - \"boolean\": true\n" +
  265 + " - \"integer\": 1\n" +
  266 + "\"content\": \"Or we can auto convert line breaks to save space\"\n" +
  267 + "\"paragraph\": \"Blank lines denote paragraph breaks\"\n";
  268 + assertThat(jsonWalker.convertToYml(), is(finalYml));
253 269  
254 270 }
255 271  
... ...