org.kuali.rice.krms.api.test
Class JAXBAssert
java.lang.Object
org.kuali.rice.krms.api.test.JAXBAssert
public final class JAXBAssert
- extends Object
A class with some assertion utilities for JAXB-related operations.
TODO - copied this from the core api test module, find a better way to share this code!
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
assertEqualXmlMarshalUnmarshal
public 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)
.
- Parameters:
objectToMarshal
- the object to marshal to XML using JAXBexpectedXml
- 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-2014 The Kuali Foundation. All Rights Reserved.