public class GroovyTestCase
extends junit.framework.TestCase
TestCase
base class in Groovy.
In case JUnit 4 is used, see GroovyAssert
.GroovyAssert
Modifier and Type | Field and Description |
---|---|
protected static java.util.logging.Logger |
log |
static java.lang.String |
TEST_SCRIPT_NAME_PREFIX |
Constructor and Description |
---|
GroovyTestCase() |
Modifier and Type | Method and Description |
---|---|
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
|
static void |
assertEquals(java.lang.Object expected,
java.lang.Object actual) |
static void |
assertEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual) |
static void |
assertEquals(java.lang.String expected,
java.lang.String actual) |
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)
|
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() |
boolean |
notYetImplemented()
Convenience method for subclasses of GroovyTestCase, identical to
|
static boolean |
notYetImplemented(java.lang.Object caller)
|
protected java.lang.String |
shouldFail(java.lang.Class clazz,
Closure code)
|
protected java.lang.String |
shouldFail(java.lang.Class clazz,
java.lang.String script)
|
protected java.lang.String |
shouldFail(Closure code)
|
protected java.lang.String |
shouldFail(java.lang.String script)
|
protected java.lang.String |
shouldFailWithCause(java.lang.Class clazz,
Closure code)
|
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, run, run, runBare, runTest, setName, setUp, tearDown, toString
protected static java.util.logging.Logger log
public static final java.lang.String TEST_SCRIPT_NAME_PREFIX
public java.lang.String getName()
getName
in class junit.framework.TestCase
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 arrayprotected void assertLength(int length, int[] array)
length
- expected lengtharray
- the arrayprotected void assertLength(int length, java.lang.Object[] array)
length
- expected lengtharray
- the arrayprotected void assertContains(char expected, char[] array)
expected
- expected character to be foundarray
- the arrayprotected void assertContains(int expected, int[] array)
expected
- expected intarray
- the arrayprotected void assertToString(java.lang.Object value, java.lang.String expected)
value
- the object to be output to the consoleexpected
- the expected String representationprotected void assertInspect(java.lang.Object value, java.lang.String expected)
value
- the object to be output to the consoleexpected
- the expected String representationprotected void assertScript(java.lang.String script) throws java.lang.Exception
java.lang.Exception
protected java.lang.String getTestClassName()
protected java.lang.String shouldFail(Closure code)
protected java.lang.String shouldFail(java.lang.Class clazz, Closure code)
protected java.lang.String shouldFailWithCause(java.lang.Class clazz, Closure code)
protected java.lang.String shouldFail(java.lang.Class clazz, java.lang.String script)
protected java.lang.String shouldFail(java.lang.String script)
protected java.lang.String fixEOLs(java.lang.String value)
public static boolean notYetImplemented(java.lang.Object caller)
public boolean notYetImplemented()
GroovyTestCase.notYetImplemented(this);.
false
when not itself already in the call stacknotYetImplemented(java.lang.Object)
public static void assertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
public static void assertEquals(java.lang.Object expected, java.lang.Object actual)
public static void assertEquals(java.lang.String expected, java.lang.String actual)