Exemplo n.º 1
0
  public void testRoundTrip() throws Exception {
    if (isUnmarshalTest()) {
      jaxbUnmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, getXMLUnmarshalMediaType());
      InputStream instream = null;
      if (writeControlDocumentLocation != null) {
        instream = ClassLoader.getSystemResourceAsStream(writeControlDocumentLocation);
      } else {
        instream = ClassLoader.getSystemResourceAsStream(resourceName);
      }
      jaxbUnmarshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/xml");
      Object testObject = null;
      if (getUnmarshalClass() != null) {
        testObject = jaxbUnmarshaller.unmarshal(new StreamSource(instream), getUnmarshalClass());
      } else {
        testObject = jaxbUnmarshaller.unmarshal(instream);
      }

      instream.close();
      xmlToObjectTest(testObject);

      objectToXMLStringWriter(testObject);
    }
  }
Exemplo n.º 2
0
 public void testObjectToXMLStringWriter() throws Exception {
   objectToXMLStringWriter(getWriteControlObject());
 }