com.atlassian.confluence.util.test.rules
Class XmlResource

java.lang.Object
  extended by com.atlassian.confluence.util.test.rules.TestResource<org.dom4j.Document>
      extended by 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:

then you can load the files in the test class the following way:
 {@code public class VersionedTemplateTest
   {

Since:
5.4

Field Summary
 
Fields inherited from class com.atlassian.confluence.util.test.rules.TestResource
nameSuffix, testClass
 
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 com.atlassian.confluence.util.test.rules.TestResource
apply, get, toFileName, toRelativePathFromClassLoaderRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlResource

public XmlResource(java.lang.Class testClass,
                   java.lang.String nameSuffix)
Method Detail

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.