|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
com.zmicer.utils.junit.JUnitUtils
public class JUnitUtils
This class contains the functionality related to the JUnit itself and should :) be used for the increasing your
productivity with junit.
It contains also the tests for these method. This class is test case itself so it is not a problem to store the tests here to.
note [zmicer]: if it is becoming large one - move the tests to the separated test class
Field Summary | |
---|---|
static org.apache.log4j.Logger |
LOG
Logger instance. |
Constructor Summary | |
---|---|
JUnitUtils()
|
Method Summary | |
---|---|
static void |
checkOnWrongArgs(Object object,
String methodName,
boolean[] requiredInfo,
Class[] argsClasses,
Object... args)
Test the given method on the wrong args. |
static String |
getRunningMethodName()
|
static String |
getRunningTestMethodName()
todo [zmicer]: the current implementation of this functionality is not correct one. |
static int |
getTestMethodsNumber(Class claz)
Get the number of the tests methods at the provided class instance. |
static void |
runFailure(Object object,
String methodName,
Class exceptionClaz,
Class[] argsClasses,
Object... arguments)
Run the test which should ended with the fail result. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger LOG
Constructor Detail |
---|
public JUnitUtils()
Method Detail |
---|
public static int getTestMethodsNumber(Class claz)
claz
- the class we need analyze. Can not be null (otherwise IllegalArgumentException
would appear).
0
) would be returnedpublic static void checkOnWrongArgs(Object object, String methodName, boolean[] requiredInfo, Class[] argsClasses, Object... args)
fail
is invoked with the description of what went wrong
method(null, new smth, null, null)
method(new smth, null, null, null)
object
- the object on which we would check.
Can not be null (otherwise IllegalArgumentException
would appear).methodName
- the method name we would test
Can not be null (otherwise IllegalArgumentException
would appear).requiredInfo
- defines which of the parameters are required (for which the IllegalArgumentException should be thrown)
Can not be null (otherwise IllegalArgumentException
would appear). The number of the
members of this array should be equal to the number of the methodParamsClasses
arg varargsClasses
- the Array of classes to be used, Can not be null (otherwise IllegalArgumentException
would appear).args
- input arguments to be used on default (without null).public static void runFailure(Object object, String methodName, Class exceptionClaz, Class[] argsClasses, Object... arguments)
object
- object on which to run. Can not be null (otherwise IllegalArgumentException
would appear).methodName
- method to be runned. Can not be null (otherwise IllegalArgumentException
would appear).exceptionClaz
- exception to be thrown and then caught, Can not be null (otherwise IllegalArgumentException
would appear).argsClasses
- classes of the arguments (to find the appropriate method..)
Can not be null (otherwise IllegalArgumentException
would appear).arguments
- the var args defining the arguments to be passed to the running methodpublic static String getRunningTestMethodName()
public static String getRunningMethodName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |