### Question:
XMLEncoderDiagramMetadataMarshaller implements DiagramMetadataMarshaller<Metadata> { @Override public String marshall(final Metadata metadata) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); XMLEncoder encoder = new XMLEncoder(os); encoder.writeObject(metadata); encoder.close(); String raw = os.toString(CHARSET); return raw; }  @Override Metadata unmarshall(final InputStream input); @Override String marshall(final Metadata metadata);  }### Answer:
@Test public void testEncode() throws Exception { MetadataImpl metadata = new MetadataImpl.MetadataImplBuilder("defSet1").build(); metadata.setTitle("title1"); metadata.setCanvasRootUUID("root1"); metadata.setShapeSetId("ss1"); metadata.setThumbData("thumbData1"); metadata.setTitle("title1"); String result = tested.marshall(metadata); assertNotNull(result); assertFalse(result.isEmpty()); assertTrue(result.contains("<java")); assertTrue(result.contains("</java>")); }