|
|||||
FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A default JUnit TestCase in Groovy. This provides a number of helper methods plus avoids the JUnit restriction of requiring all test* methods to be void return type.
Field Summary | |
---|---|
int |
counter
|
Logger |
log
|
ThreadLocal |
notYetImplementedFlag
|
boolean |
useAgileDoxNaming
|
Constructor Summary | |
GroovyTestCase()
|
Method Summary | |
---|---|
void |
assertArrayEquals(def expected, def value)
Asserts that the arrays are equivalent and contain the same values |
void |
assertContains(char expected, def array)
Asserts that the array of characters contains a given char |
void |
assertContains(int expected, def array)
Asserts that the array of ints contains a given int |
static void |
assertEquals(String message, Object expected, Object actual)
|
static void |
assertEquals(Object expected, Object actual)
|
static void |
assertEquals(String expected, String actual)
|
void |
assertInspect(Object value, String expected)
Asserts that the value of inspect() on the given object matches the given text string |
void |
assertLength(int length, def array)
Asserts that the array of characters has a given length |
void |
assertLength(int length, def array)
Asserts that the array of ints has a given length |
void |
assertLength(int length, def array)
Asserts that the array of objects has a given length |
void |
assertScript(String script)
Asserts that the script runs without any exceptions |
void |
assertToString(Object value, String expected)
Asserts that the value of toString() on the given object matches the given text string |
static Method |
findRunningJUnitTestMethod(Class caller)
From JUnit. |
String |
fixEOLs(String value)
Returns a copy of a string in which all EOLs are \n. |
String |
getMethodName()
|
String |
getName()
Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!) |
String |
getTestClassName()
|
static boolean |
isPublicTestMethod(Method method)
From Junit. |
static boolean |
notYetImplemented(TestCase caller)
|
boolean |
notYetImplemented()
Convenience method for subclasses of GroovyTestCase, identical to GroovyTestCase.notYetImplemented(this);. |
String |
shouldFail(Closure code)
Asserts that the given code closure fails when it is evaluated |
String |
shouldFail(Class clazz, Closure code)
Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown. |
String |
shouldFailWithCause(Class clazz, Closure code)
|
Throwable |
unwrap(GroovyRuntimeException gre)
|
Constructor Detail |
---|
public GroovyTestCase()
Method Detail |
---|
void assertArrayEquals(def expected, def value)
void assertContains(char expected, def array)
void assertContains(int expected, def array)
public static void assertEquals(String message, Object expected, Object actual)
public static void assertEquals(Object expected, Object actual)
public static void assertEquals(String expected, String actual)
void assertInspect(Object value, String expected)
void assertLength(int length, def array)
void assertLength(int length, def array)
void assertLength(int length, def array)
void assertScript(String script)
void assertToString(Object value, String expected)
static Method findRunningJUnitTestMethod(Class caller)
String fixEOLs(String value)
public String getMethodName()
public String getName()
String getTestClassName()
static boolean isPublicTestMethod(Method method)
true
if this is a junit test.
public static boolean notYetImplemented(TestCase caller)
public boolean notYetImplemented()
GroovyTestCase.notYetImplemented(this);.
String shouldFail(Closure code)
String shouldFail(Class clazz, Closure code)
String shouldFailWithCause(Class clazz, Closure code)
Throwable unwrap(GroovyRuntimeException gre)