com.atlassian.confluence.util.test.rules
Class XmlResource
java.lang.Object
com.atlassian.confluence.util.test.rules.TestResource<org.dom4j.Document>
com.atlassian.confluence.util.test.rules.XmlResource
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class XmlResource
- extends TestResource<org.dom4j.Document>
Load an XML resource into memory for testing purposes.
E.g. the following files reside in a Maven module with Surefire setup:
- src/test/java/com/atlassian/confluence/notifications/impl/VersionedTemplateTest.java
- src/test/resources/com/atlassian/confluence/notifications/impl/multiple-version-groups-expected.xml
- src/test/resources/com/atlassian/confluence/notifications/impl/multiple-version-groups-source.xml
then you can load the files in the test class the following way:
{@code public class VersionedTemplateTest
{
- Since:
- 5.4
Constructor Summary |
XmlResource(java.lang.Class testClass,
java.lang.String nameSuffix)
|
Method Summary |
void |
assertEquals(org.dom4j.Document actualDocument)
|
protected org.dom4j.Document |
load(java.io.InputStream testResourceStream)
|
static java.lang.String |
serialize(org.dom4j.Document document)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlResource
public XmlResource(java.lang.Class testClass,
java.lang.String nameSuffix)
load
protected org.dom4j.Document load(java.io.InputStream testResourceStream)
- Specified by:
load
in class TestResource<org.dom4j.Document>
assertEquals
public void assertEquals(org.dom4j.Document actualDocument)
serialize
public static java.lang.String serialize(org.dom4j.Document document)
Copyright © 2003-2014 Atlassian. All Rights Reserved.