org.yaml.snakeyaml.reader.ReaderException Java Examples
The following examples show how to use
org.yaml.snakeyaml.reader.ReaderException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrintableUnicodeTest.java From snake-yaml with Apache License 2.0 | 6 votes |
public void testDeserialization() { // test deserialization of non-escaped codepoints for (int c = Character.MIN_VALUE; c <= Character.MAX_VALUE; c++) { // ignore breaks, which have special meaning if (c == 0x0A || c == 0x0D || c == 0x85 || c == 0x2028 || c == 0x2029) continue; if (!isAcceptable(c) || c == 0x27) continue; String expected = Character.toString((char) c); String serialized = "'" + expected + "'"; String result; try { result = new Yaml().load(serialized).toString(); } catch (ReaderException e) { fail(String .format("U+%04x: Deserialization threw ReaderException for an acceptable character\n", c)); continue; } if (!result.equals(expected)) fail(String.format("U+%04x: Deserialization incorrect: %s\n", c, hexdump(result))); } }
Example #2
Source File: PrintableUnicodeTest.java From snake-yaml with Apache License 2.0 | 6 votes |
public void testDeserialization2() { // test deserialization of escaped codepoints // "Any such characters must be presented using escape sequences." for (int c = Character.MIN_VALUE; c <= Character.MAX_VALUE; c++) { String expected = Character.toString((char) c); String serialized = String.format("\"\\u%04x\"", c); String result; try { result = new Yaml().load(serialized).toString(); } catch (ReaderException e) { fail(String .format("U+%04x: Deserialization threw ReaderException for an acceptable escaped character\n", c)); continue; } if (!result.equals(expected)) fail(String.format("U+%04x: Deserialization of escaped character incorrect: %s\n", c, hexdump(result))); } }
Example #3
Source File: ReaderExceptionTest.java From snake-yaml with Apache License 2.0 | 5 votes |
public void testGetters() { try { new Yaml().load("012\u0019"); fail(); } catch (ReaderException e) { assertEquals(3, e.getPosition()); assertEquals("'string'", e.getName()); assertEquals('\u0019', e.getCharacter()); } }