### Question:
AtomDOSerializer implements DOSerializer, Constants { public void serialize(DigitalObject obj, OutputStream out, String encoding, int transContext) throws ObjectIntegrityException, StreamIOException, UnsupportedEncodingException { if (encoding == null || encoding == "")encoding = "UTF-8"; Feed feed = abdera.newFeed(); ZipOutputStream zout = null; if (m_format.equals(ATOM_ZIP1_1)) { zout = new ZipOutputStream(out); } addObjectProperties(obj, feed); feed.setIcon("http: addDatastreams(feed, obj, zout, encoding, transContext); if (m_format.equals(ATOM_ZIP1_1)) { try { zout.putNextEntry(new ZipEntry("atommanifest.xml")); feed.writeTo("prettyxml", zout); zout.closeEntry(); zout.close(); } catch (IOException e) { throw new StreamIOException(e.getMessage(), e); } } else { try { feed.writeTo("prettyxml", out); } catch (IOException e) { throw new StreamIOException(e.getMessage(), e); } } } AtomDOSerializer();  AtomDOSerializer(XMLFormat format);  AtomDOSerializer(XMLFormat format, DOTranslationUtility translator); DOSerializer getInstance(); void serialize(DigitalObject obj,
                          OutputStream out,
                          String encoding,
                          int transContext); static final XMLFormat DEFAULT_FORMAT; }### Answer:
@Test public void testSerializeFromFOXML() throws Exception { String source = "src/main/resources/demo/demo-objects/foxml/local-server-demos/image-collection-demo/dataObjects/demo_SmileyBeerGlass.xml"; source = "src/main/resources/demo/demo-objects/foxml/local-server-demos/formatting-objects-demo/obj_demo_26.xml"; InputStream in = new FileInputStream(source); File f = File.createTempFile("test", null); OutputStream out = new FileOutputStream(f); DODeserializer deser = new FOXML1_1DODeserializer(); DigitalObject obj = new BasicDigitalObject(); deser.deserialize(in, obj, "UTF-8", DESERIALIZE_INSTANCE); setObjectDefaults(obj); DOSerializer serializer = new AtomDOSerializer(); serializer.serialize(obj, out, "UTF-8", SERIALIZE_EXPORT_ARCHIVE); }
@Test public void testSerialize() throws Exception { DigitalObject obj = createTestObject(Models.FEDORA_OBJECT_3_0); obj.setLastModDate(new Date()); DatastreamXMLMetadata ds1 = createXDatastream("DS1"); ds1.DSCreateDT = new Date(); obj.addDatastreamVersion(ds1, true); OutputStream out = new ByteArrayOutputStream(); DOSerializer serializer = new AtomDOSerializer(); serializer.serialize(obj, out, "UTF-8", SERIALIZE_EXPORT_ARCHIVE); }