-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrated tests to junit; improve errors
- Loading branch information
Showing
7 changed files
with
275 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package dev.ingon.json.zero; | ||
|
||
import org.junit.Test; | ||
|
||
import dev.ingon.json.zero.hl.JsonMapHandler; | ||
import dev.ingon.json.zero.hl.JsonParser; | ||
import dev.ingon.json.zero.hl.JsonStringHandler; | ||
|
||
public class Examples { | ||
@Test | ||
public void testHello() throws Exception { | ||
Parser.parse("{\"hello\": \"world\"}".toCharArray(), new DefaultContentHandler() { | ||
@Override | ||
public boolean beginObjectEntry(char[] source, int begin, int end, int escapeCount) throws ParseException { | ||
System.out.print(readString(source, begin, end, escapeCount)); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean stringValue(char[] source, int begin, int end, int escapeCount) throws ParseException { | ||
System.out.print(" "); | ||
System.out.println(readString(source, begin, end, escapeCount)); | ||
return false; | ||
} | ||
}); | ||
} | ||
|
||
@Test | ||
public void testHelloHL() throws Exception { | ||
var result = JsonParser.parse("{\"hello\": \"world\"}".toCharArray(), | ||
new JsonMapHandler<String>(new JsonStringHandler())); | ||
for (var e : result.entrySet()) { | ||
System.out.format("%s %s", e.getKey(), e.getValue()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.