Package groovy.test
Class GroovyTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
groovy.test.GroovyTestCase
- All Implemented Interfaces:
- junit.framework.Test
public class GroovyTestCase
extends junit.framework.TestCase
A JUnit 3 
TestCase base class in Groovy.
 In case JUnit 4 is used, see GroovyAssert.- See Also:
- GroovyAssert
- 
Field SummaryFields Modifier and Type Field Description protected static java.util.logging.Loggerlogstatic java.lang.StringTEST_SCRIPT_NAME_PREFIX
- 
Constructor SummaryConstructors Constructor Description GroovyTestCase()
- 
Method SummaryModifier and Type Method Description protected voidassertArrayEquals(java.lang.Object[] expected, java.lang.Object[] value)Asserts that the arrays are equivalent and contain the same valuesprotected voidassertContains(char expected, char[] array)Asserts that the array of characters contains a given charprotected voidassertContains(int expected, int[] array)Asserts that the array of ints contains a given intstatic voidassertEquals(java.lang.Object expected, java.lang.Object actual)static voidassertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)static voidassertEquals(java.lang.String expected, java.lang.String actual)protected voidassertInspect(java.lang.Object value, java.lang.String expected)Asserts that the value of inspect() on the given object matches the given text stringprotected voidassertLength(int length, char[] array)Asserts that the array of characters has a given lengthprotected voidassertLength(int length, int[] array)Asserts that the array of ints has a given lengthprotected voidassertLength(int length, java.lang.Object[] array)Asserts that the array of objects has a given lengthprotected voidassertScript(java.lang.String script)protected voidassertToString(java.lang.Object value, java.lang.String expected)Asserts that the value of toString() on the given object matches the given text stringprotected java.lang.StringfixEOLs(java.lang.String value)Returns a copy of a string in which all EOLs are \n.java.lang.StringgetMethodName()java.lang.StringgetName()Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!)protected java.lang.StringgetTestClassName()booleannotYetImplemented()Convenience method for subclasses of GroovyTestCase, identical tostatic booleannotYetImplemented(java.lang.Object caller)protected java.lang.StringshouldFail(Closure code)protected java.lang.StringshouldFail(java.lang.Class clazz, Closure code)protected java.lang.StringshouldFail(java.lang.Class clazz, java.lang.String script)protected java.lang.StringshouldFail(java.lang.String script)protected java.lang.StringshouldFailWithCause(java.lang.Class clazz, Closure code)Methods inherited from class junit.framework.TestCaseassertEquals, 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, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
- 
Field Details- 
logprotected static java.util.logging.Logger log
- 
TEST_SCRIPT_NAME_PREFIXpublic static final java.lang.String TEST_SCRIPT_NAME_PREFIX- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
GroovyTestCasepublic GroovyTestCase()
 
- 
- 
Method Details- 
getNamepublic java.lang.String getName()Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!)- Overrides:
- getNamein class- junit.framework.TestCase
 
- 
getMethodNamepublic java.lang.String getMethodName()
- 
assertArrayEqualsprotected void assertArrayEquals(java.lang.Object[] expected, java.lang.Object[] value)Asserts that the arrays are equivalent and contain the same values- Parameters:
- expected-
- value-
 
- 
assertLengthprotected void assertLength(int length, char[] array)Asserts that the array of characters has a given length- Parameters:
- length- expected length
- array- the array
 
- 
assertLengthprotected void assertLength(int length, int[] array)Asserts that the array of ints has a given length- Parameters:
- length- expected length
- array- the array
 
- 
assertLengthprotected void assertLength(int length, java.lang.Object[] array)Asserts that the array of objects has a given length- Parameters:
- length- expected length
- array- the array
 
- 
assertContainsprotected void assertContains(char expected, char[] array)Asserts that the array of characters contains a given char- Parameters:
- expected- expected character to be found
- array- the array
 
- 
assertContainsprotected void assertContains(int expected, int[] array)Asserts that the array of ints contains a given int- Parameters:
- expected- expected int
- array- the array
 
- 
assertToStringprotected 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- Parameters:
- value- the object to be output to the console
- expected- the expected String representation
 
- 
assertInspectprotected 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- Parameters:
- value- the object to be output to the console
- expected- the expected String representation
 
- 
assertScriptprotected void assertScript(java.lang.String script) throws java.lang.Exception- Throws:
- java.lang.Exception
 
- 
getTestClassNameprotected java.lang.String getTestClassName()
- 
shouldFail
- 
shouldFail
- 
shouldFailWithCause
- 
shouldFailprotected java.lang.String shouldFail(java.lang.Class clazz, java.lang.String script)
- 
shouldFailprotected java.lang.String shouldFail(java.lang.String script)
- 
fixEOLsprotected java.lang.String fixEOLs(java.lang.String value)Returns a copy of a string in which all EOLs are \n.
- 
notYetImplementedpublic static boolean notYetImplemented(java.lang.Object caller)
- 
notYetImplementedpublic boolean notYetImplemented()Convenience method for subclasses of GroovyTestCase, identical toGroovyTestCase.notYetImplemented(this); .- Returns:
- falsewhen not itself already in the call stack
- See Also:
- notYetImplemented(java.lang.Object)
 
- 
assertEqualspublic static void assertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
- 
assertEqualspublic static void assertEquals(java.lang.Object expected, java.lang.Object actual)
- 
assertEqualspublic static void assertEquals(java.lang.String expected, java.lang.String actual)
 
-