|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonar.test.TestUtils
public class TestUtils
Utilities for unit tests
| Constructor Summary | |
|---|---|
TestUtils()
|
|
| Method Summary | |
|---|---|
static void |
assertExists(java.io.File file)
Checks that a file or a directory is not null and exists. |
static void |
assertSimilarXml(java.lang.String expectedXml,
java.lang.String xml)
|
static java.io.File |
getResource(java.lang.Class baseClass,
java.lang.String path)
Search for a resource in the classpath. |
static java.io.File |
getResource(java.lang.String path)
Search for a test resource in the classpath. |
static java.io.File |
getTestTempDir(java.lang.Class baseClass,
java.lang.String testName)
Shortcut for getTestTempDir(baseClass, testName, true) : cleans the unit test directory |
static java.io.File |
getTestTempDir(java.lang.Class baseClass,
java.lang.String testName,
boolean clean)
Create a temporary directory for unit tests. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TestUtils()
| Method Detail |
|---|
public static java.io.File getResource(java.lang.String path)
path - the starting slash is optional
public static java.io.File getResource(java.lang.Class baseClass,
java.lang.String path)
public static java.io.File getTestTempDir(java.lang.Class baseClass,
java.lang.String testName)
public static java.io.File getTestTempDir(java.lang.Class baseClass,
java.lang.String testName,
boolean clean)
baseClass - the unit test classtestName - the test nameclean - remove all the sub-directories and files ?public static void assertExists(java.io.File file)
public static void assertSimilarXml(java.lang.String expectedXml,
java.lang.String xml)
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||