DumperOptions options = new DumperOptions();
options.setWidth(400);
Yaml yaml = new Yaml(new ImmutablesRepresenter(), options);
Insets insets = new Insets(10, 20, 30, 40);
Color color = new Color(100, 150, 200);
MatteBorder border = BorderFactory.createMatteBorder(insets.top, insets.left,
insets.bottom, insets.right, color);
String dump = yaml.dump(border);
assertEquals(
"!!javax.swing.border.MatteBorder [!!java.awt.Insets [10, 20, 30, 40], !!java.awt.Color [100, 150, 200, 255]]\n",
dump);
Object loaded = yaml.load(dump);
assertTrue(loaded instanceof MatteBorder);
MatteBorder loadedBorder = (MatteBorder) loaded;
assertEquals(insets, loadedBorder.getBorderInsets());
assertEquals(color, loadedBorder.getMatteColor());
}