org.kuali.rice.coreservice.test
Class JAXBAssert

java.lang.Object
  extended by org.kuali.rice.coreservice.test.JAXBAssert

public final class JAXBAssert
extends Object

A class with some assertion utilities for JAXB-related operations.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
static void assertEqualXmlMarshalUnmarshal(Object objectToMarshal, String expectedXml, Class<?>... classesToBeBound)
          Performs the following steps and assertions: Creates a new JAXBContext with the given list of classesToBeBound. Marshals the provided objectToMarshall to XML. Unmarshals the marshaled XML to recreate the original object. Asserts that the newly unmarhsaled object and the original provided object are equal by invoking Object.equals(Object). Unmarshals the given expectedXml to an object and asserts that it is equal with the original unmarshaled object by invoking Object.equals(Object).
static void assertEqualXmlMarshalUnmarshalWithResource(Object objectToMarshal, InputStream expectedXml, Class<?>... classesToBeBound)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertEqualXmlMarshalUnmarshal

public static void assertEqualXmlMarshalUnmarshal(Object objectToMarshal,
                                                  String expectedXml,
                                                  Class<?>... classesToBeBound)
Performs the following steps and assertions:
  1. Creates a new JAXBContext with the given list of classesToBeBound.
  2. Marshals the provided objectToMarshall to XML.
  3. Unmarshals the marshaled XML to recreate the original object.
  4. Asserts that the newly unmarhsaled object and the original provided object are equal by invoking Object.equals(Object).
  5. Unmarshals the given expectedXml to an object and asserts that it is equal with the original unmarshaled object by invoking Object.equals(Object).

Parameters:
objectToMarshal - the object to marshal to XML using JAXB
expectedXml - an XML string that will be unmarshaled to an Object and compared with objectToMarshal using Object.equals(Object)
classesToBeBound - - list of java classes to be recognized by the created JAXBContext

assertEqualXmlMarshalUnmarshalWithResource

public static void assertEqualXmlMarshalUnmarshalWithResource(Object objectToMarshal,
                                                              InputStream expectedXml,
                                                              Class<?>... classesToBeBound)
                                                       throws IOException
Throws:
IOException


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.