Class TestResources
java.lang.Object
org.junit.rules.TestWatcher
org.apache.maven.plugin.testing.resources.TestResources
- All Implemented Interfaces:
org.junit.rules.TestRule
public class TestResources
extends org.junit.rules.TestWatcher
Junit4 test
Rule
to extract and assert test resources.- Since:
- 3.1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertDirectoryContents
(File dir, String... expectedPaths) static void
assertFileContents
(File basedir, String expectedPath, String actualPath) static void
static void
getBasedir
(String project) Creates new clean copy of test project directory structure.static void
protected void
starting
(org.junit.runner.Description d) static void
static void
Methods inherited from class org.junit.rules.TestWatcher
apply, failed, finished, skipped, skipped, succeeded
-
Constructor Details
-
TestResources
public TestResources() -
TestResources
-
-
Method Details
-
starting
protected void starting(org.junit.runner.Description d) - Overrides:
starting
in classorg.junit.rules.TestWatcher
-
getBasedir
Creates new clean copy of test project directory structure. The copy is named after both the test being executed and test project name, which allows the same test project can be used by multiple tests and by different instances of the same parametrized tests.TODO Provide alternative working directory naming for Windows, which still limits path names to ~250 charecters
- Throws:
IOException
-
cp
- Throws:
IOException
-
assertFileContents
public static void assertFileContents(File basedir, String expectedPath, String actualPath) throws IOException - Throws:
IOException
-
assertDirectoryContents
-
touch
- Throws:
InterruptedException
-
touch
- Throws:
InterruptedException
-
rm
-
create
- Throws:
IOException
- Since:
- 3.2.0
-