### Question:
Parse extends RapidoidThing { public static <T> T data(String data, Class<T> targetType) { return data(data.getBytes(), targetType); }  static T data(String data, Class<T> targetType); @SuppressWarnings("unchecked") static T data(byte[] data, Class<T> targetType);  }### Answer:
@Test public void testXMLParse() { String xml = XML.stringify(new Person("abc", 123)); System.out.println(xml); Person p = Parse.data(xml, Person.class); eq(p.getName(), "abc"); eq(p.getAge(), 123); }
@Test public void testJSONParse() { String json = JSON.stringify(new Person("abc", 123)); System.out.println(json); Person p = Parse.data(json, Person.class); eq(p.getName(), "abc"); eq(p.getAge(), 123); isNull(Parse.data("null", Person.class)); eq(Parse.data("3", Integer.class).intValue(), 3); isTrue(Parse.data("true", Boolean.class).booleanValue()); isFalse(Parse.data("false", Boolean.class).booleanValue()); eq(Parse.data("\"123\"", String.class), "123"); }
@Test public void testYAMLParse() { String yaml = YAML.stringify(new Person("abc", 123)); System.out.println(yaml); Person p = Parse.data(yaml, Person.class); eq(p.getName(), "abc"); eq(p.getAge(), 123); }