|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
groovy.util.GroovyTestCase
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 | |
private static int |
counter
|
protected java.util.logging.Logger |
log
|
private boolean |
useAgileDoxNaming
|
| Fields inherited from class junit.framework.TestCase |
|
| Constructor Summary | |
GroovyTestCase()
|
|
| Method Summary | |
protected void |
assertArrayEquals(java.lang.Object[] expected,
java.lang.Object[] value)
Asserts that the arrays are equivalent and contain the same values |
protected void |
assertContains(char expected,
char[] array)
Asserts that the array of characters contains a given char |
protected void |
assertContains(int expected,
int[] array)
Asserts that the array of ints contains a given int |
protected void |
assertInspect(java.lang.Object value,
java.lang.String expected)
Asserts that the value of inspect() on the given object matches the given text string |
protected void |
assertLength(int length,
char[] array)
Asserts that the array of characters has a given length |
protected void |
assertLength(int length,
int[] array)
Asserts that the array of ints has a given length |
protected void |
assertLength(int length,
java.lang.Object[] array)
Asserts that the array of objects has a given length |
protected void |
assertScript(java.lang.String script)
Asserts that the script runs without any exceptions |
protected void |
assertToString(java.lang.Object value,
java.lang.String expected)
Asserts that the value of toString() on the given object matches the given text string |
protected java.lang.String |
fixEOLs(java.lang.String value)
Returns a copy of a string in which all EOLs are \n. |
java.lang.String |
getMethodName()
|
java.lang.String |
getName()
Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!) |
protected java.lang.String |
getTestClassName()
|
protected void |
shouldFail(java.lang.Class clazz,
Closure code)
Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown. |
protected void |
shouldFail(Closure code)
Asserts that the given code closure fails when it is evaluated |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, 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 |
protected java.util.logging.Logger log
private static int counter
private boolean useAgileDoxNaming
| Constructor Detail |
public GroovyTestCase()
| Method Detail |
public java.lang.String getName()
public java.lang.String getMethodName()
protected void assertArrayEquals(java.lang.Object[] expected,
java.lang.Object[] value)
expected - value -
protected void assertLength(int length,
char[] array)
length - expected lengtharray - the array
protected void assertLength(int length,
int[] array)
length - expected lengtharray - the array
protected void assertLength(int length,
java.lang.Object[] array)
length - expected lengtharray - the array
protected void assertContains(char expected,
char[] array)
expected - expected character to be foundarray - the array
protected void assertContains(int expected,
int[] array)
expected - expected intarray - the array
protected void assertToString(java.lang.Object value,
java.lang.String expected)
value - the object to be output to the consoleexpected - the expected String representation
protected void assertInspect(java.lang.Object value,
java.lang.String expected)
value - the object to be output to the consoleexpected - the expected String representation
protected void assertScript(java.lang.String script)
throws java.lang.Exception
script - the script that should pass without any exception thrown
java.lang.Exceptionprotected java.lang.String getTestClassName()
protected void shouldFail(Closure code)
code -
protected void shouldFail(java.lang.Class clazz,
Closure code)
clazz - the class of the expected exceptioncode - the closure that should failprotected java.lang.String fixEOLs(java.lang.String value)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||