YAML { public static YamlValue parse(String string) throws YamlException { return YamlValue.of(decode(string)); } protected  YAML(); static YamlValue parse(String string); static YamlValue parse(Reader reader); static T decode(String string); static T decode(Reader reader); static T decodeYamlOrJson(Resource resource);  }
@Test public void testParseSimpleMap() { String yaml = "p: value"; YamlObject o = YAML.parse(yaml).asYamlObject(); assertEquals("value",o.get("p")); }
@Test public void testParseScalar() { String yaml = "x"; YamlScalar s = YAML.parse(yaml).asYamlScalar(); assertEquals(s.raw(), "x"); }
@Test public void testParseSimpleCollection() { String yaml = "- v"; YamlCollection c = YAML.parse(yaml).asYamlCollection(); assertEquals(1,c.size()); assertEquals("v",c.get(0)); }
@Test public void testParseNestedMap() { String yaml = "p1: v1\np2: v2\np3:\n np1: nv1\n np2: nv2"; YamlObject o = YAML.parse(yaml).asYamlObject(); Map<String, Object> np = o.get("p3"); assertEquals("nv1", np.get("np1")); }