mil.dod.th.ose.utils/test/mil/dod/th/ose/utils/xml/TestXMLUtils.java
@Test
    public void testFromXML() throws JAXBException
    {
        JaxbExample expectedObs = createExample(); 
        
        JAXBContext context = JAXBContext.newInstance(JaxbExample.class);
        final Marshaller marshaller = context.createMarshaller();
        
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        
        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        
        marshaller.marshal(expectedObs, byteStream);
        
        byte[] bArray = byteStream.toByteArray();
        assertThat(bArray, notNullValue());
        
        JaxbExample receivedObs = (JaxbExample)XmlUtils.fromXML(bArray, JaxbExample.class);
        
        assertThat(receivedObs, notNullValue());
    }
/**
     * Verify fromXML creates an object from XML data.
     */
Verify fromXML creates an object from XML data.
Verify fromXML creates an object from XML data .
@Test
    public void testFromXML() throws JAXBException
    {
        JaxbExample expectedObs = createExample(); 
        JAXBContext context = JAXBContext.newInstance(JaxbExample.class);
        final Marshaller marshaller = context.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        marshaller.marshal(expectedObs, byteStream);
        byte[] bArray = byteStream.toByteArray();
        assertThat(bArray, notNullValue());
        JaxbExample receivedObs = (JaxbExample)XmlUtils.fromXML(bArray, JaxbExample.class);
        assertThat(receivedObs, notNullValue());
    }
@ Test public void testFromXML ( ) throws JAXBException { JaxbExample expectedObs = createExample ( ) ; JAXBContext context = JAXBContext . newInstance ( JaxbExample . class ) ; final Marshaller marshaller = context . createMarshaller ( ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , true ) ; final ByteArrayOutputStream byteStream = new ByteArrayOutputStream ( ) ; marshaller . marshal ( expectedObs , byteStream ) ; byte [ ] bArray = byteStream . toByteArray ( ) ; assertThat ( bArray , notNullValue ( ) ) ; JaxbExample receivedObs = ( JaxbExample ) XmlUtils . fromXML ( bArray , JaxbExample . class ) ; assertThat ( receivedObs , notNullValue ( ) ) ; }
Verify fromXML creates an object from XML data.
Verify fromXML creates an object from XML data .