org.sonatype.sisu.litmus.testsupport
Class TestMethod

java.lang.Object
  extended by org.junit.rules.TestWatchman
      extended by org.sonatype.sisu.litmus.testsupport.TestMethod
All Implemented Interfaces:
org.junit.rules.MethodRule

public class TestMethod
extends org.junit.rules.TestWatchman

Test method related utilities.

Since:
1.0

Constructor Summary
TestMethod(TestUtil util)
          Constructor.
 
Method Summary
 String getName()
          Returns the name of the currently-running test method
 File getTargetDirMethodFile(String root, String path)
          Returns a directory specific to running test method.
 File resolveFile(File root, String path)
          Resolves a test file by looking up the specified path into test resources starting with a specified root.
 void starting(org.junit.runners.model.FrameworkMethod method)
          
 
Methods inherited from class org.junit.rules.TestWatchman
apply, failed, finished, succeeded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestMethod

public TestMethod(TestUtil util)
Constructor.

Parameters:
util - test util
Method Detail

starting

public void starting(org.junit.runners.model.FrameworkMethod method)

Overrides:
starting in class org.junit.rules.TestWatchman
Since:
1.0

getName

public String getName()
Returns the name of the currently-running test method

Returns:
the name of the currently-running test method

getTargetDirMethodFile

public File getTargetDirMethodFile(String root,
                                   String path)
Returns a directory specific to running test method.

Format: <project>/target/<root>/<test class package>/<test class name>/<test method name>/<path>

Parameters:
root - root name relative to target dir
path - path to be appended to test method specific directory
Returns:
directory specific to running test method + provided path

resolveFile

public File resolveFile(File root,
                        String path)
                 throws FileNotFoundException
Resolves a test file by looking up the specified path into test resources starting with a specified root.

It searches the following path locations:
<project>/src/test/<root>/<test class package>/<test class name>/<test method name>/<path>
<project>/src/test/<root>/<test class package>/<test class name>/<path>
<project>/src/test/<root>/<test class package>/<path>
<project>/src/test/<root>/<path>

Parameters:
root - root directory
path - path to look up
Returns:
found file
Throws:
FileNotFoundException - if path cannot be found in any of above locations
Since:
1.0


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.