Examples of loadAs()


Examples of org.yaml.snakeyaml.Yaml.loadAs()

     */
    public void testClassAndTag() {
        String output = "name: !!whatever Bean25\nshape: !!org.yaml.snakeyaml.javabeans.Triangle\n  name: Triangle25\n";
        Yaml beanLoader = new Yaml();
        try {
            beanLoader.loadAs(output, TriangleBean.class);
            fail("Runtime class has less priority then an explicit tag");
        } catch (Exception e) {
            assertTrue(e
                    .getMessage()
                    .startsWith(
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

        String output = yaml.dumpAsMap(father);
        String etalon = Util.getLocalResource("recursive/generics/no-children-2.yaml");
        assertEquals(etalon, output);
        //
        Yaml loader = new Yaml();
        HumanGen father2 = (HumanGen) loader.loadAs(etalon, HumanGen.class);
        assertNotNull(father2);
        assertEquals("Father", father2.getName());
        assertEquals("Mother", father2.getPartner().getName());
        assertEquals("Father", father2.getBankAccountOwner().getName());
        assertSame(father2, father2.getBankAccountOwner());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.