bean.setName("Bahrack");
bean.setAge(-47);
JavaBeanWithStaticState.setType("Type3");
JavaBeanWithStaticState.color = "Violet";
Representer repr = new Representer();
repr.addClassTag(Wrapper.class, new Tag("!mybean"));
Yaml yaml = new Yaml(repr);
String output = yaml.dump(new Wrapper(bean));
// System.out.println(output);
assertEquals("!mybean {age: -47, color: Violet, name: Bahrack, type: Type3}\n", output);
// parse back to instance
Constructor constr = new Constructor();
TypeDescription description = new TypeDescription(Wrapper.class, new Tag("!mybean"));
constr.addTypeDescription(description);
yaml = new Yaml(constr);
Wrapper wrapper = (Wrapper) yaml.load(output);
JavaBeanWithStaticState bean2 = wrapper.createBean();
assertEquals(-47, bean2.getAge());