DcUtils { public static void marshal(Result target, OaiDcType oaidc, boolean indent) { try { Marshaller m = defaultMarshaller(indent); m.marshal(new ObjectFactory().createDc(oaidc), target); } catch (JAXBException ex) { throw new DataBindingException(ex); } }  static JAXBContext defaultJaxbContext(); static Marshaller defaultMarshaller(boolean indent); static Unmarshaller defaultUnmarshaller(); static String toXml(OaiDcType mods, boolean indent); static void marshal(Result target, OaiDcType oaidc, boolean indent); static T unmarshal(String source, Class<T> type); static T unmarshal(URL source, Class<T> type); static T unmarshal(Source source, Class<T> type); static Transformer modsTransformer(String model); static String getLabel(OaiDcType dc); static OaiDcType merge(OaiDcType dc, OaiDcType add); static void merge(List<ElementType> elms, List<ElementType> add); static void merge(List<ElementType> elms, ElementType add); static void addPid(OaiDcType dc, String pid); static void addModel(OaiDcType dc, String modelId); static void addTitle(OaiDcType dc, String title); static void addOwner(OaiDcType dc, Collection<String> owners); static void addOwner(OaiDcType dc, String owner); static void addElementType(List<ElementType> elms, String value);  }
@Test public void testMarshal() { OaiDcType dc = createFullDc(); String xml = DcUtils.toXml(dc, true); assertNotNull(xml); OaiDcType result = DcUtils.unmarshal(new StreamSource(new StringReader(xml)), OaiDcType.class); assertNotNull(result); assertEquals(dc.getContributors(), result.getContributors()); assertEquals(dc.getCoverages(), result.getCoverages()); assertEquals(dc.getCreators(), result.getCreators()); assertEquals(dc.getDates(), result.getDates()); assertEquals(dc.getDescriptions(), result.getDescriptions()); assertEquals(dc.getFormats(), result.getFormats()); assertEquals(dc.getIdentifiers(), result.getIdentifiers()); assertEquals(dc.getLanguages(), result.getLanguages()); assertEquals(dc.getPublishers(), result.getPublishers()); assertEquals(dc.getRelations(), result.getRelations()); assertEquals(dc.getRights(), result.getRights()); assertEquals(dc.getSources(), result.getSources()); assertEquals(dc.getSubjects(), result.getSubjects()); assertEquals(dc.getTitles(), result.getTitles()); assertEquals(dc.getTypes(), result.getTypes()); }