GroovyTestCase (Groovy 5.0.0)

Package: groovy.test

## [Java] Class GroovyTestCase

- groovy.test.GroovyTestCase

-     public class GroovyTestCase
      extends TestCase

  A JUnit 3 TestCase base class in Groovy. In case JUnit 4 is used, see GroovyAssert.

  See Also:
    GroovyAssert

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `TEST_SCRIPT_NAME_PREFIX` |
    `protected static Logger` | `log` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `assertArrayEquals(Object[] expected, 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
    `` | `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)`
    `` | `protected void` | `assertInspect(Object value, 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, Object[] array)` Asserts that the array of objects has a given length
    `` | `protected void` | `assertScript(String script)` see GroovyAssert.assertScript
    `` | `protected void` | `assertToString(Object value, String expected)` Asserts that the value of toString() on the given object matches the given text string
    `` | `protected String` | `fixEOLs(String value)` Returns a copy of a string in which all EOLs are \n.
    `` | `public String` | `getMethodName()`
    `` | `public String` | `getName()` Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!)
    `` | `protected String` | `getTestClassName()`
    `` | `public static boolean` | `notYetImplemented(Object caller)` see GroovyAssert.notYetImplemented
    `` | `public boolean` | `notYetImplemented()` Convenience method for subclasses of GroovyTestCase, identical to
         GroovyTestCase.notYetImplemented(this);
    .
    `` | `protected String` | `shouldFail(Closure code)` see GroovyAssert.shouldFail
    `` | `protected String` | `shouldFail(Class clazz, Closure code)` see GroovyAssert.shouldFail
    `` | `protected String` | `shouldFail(Class clazz, String script)` see GroovyAssert.shouldFail
    `` | `protected String` | `shouldFail(String script)` see GroovyAssert.shouldFail
    `` | `protected String` | `shouldFailWithCause(Class clazz, Closure code)` see GroovyAssert.shouldFailWithCause

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class TestCase` | `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, countTestCases, equals, fail, fail, failNotEquals, failNotSame, failSame, format, getClass, getName, hashCode, notify, notifyAll, run, run, runBare, setName, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final String TEST_SCRIPT_NAME_PREFIX

    - #### protected static Logger log

  - ### Method Detail

    - #### protected void assertArrayEquals(Object[] expected, Object[] value)

      Asserts that the arrays are equivalent and contain the same values

      Parameters:
        expected
        value

    - #### protected 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

    - #### protected void assertContains(int expected, int[] array)

      Asserts that the array of ints contains a given int

      Parameters:
        `expected` - expected int
        `array` - the 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)

    - #### protected void assertInspect(Object value, 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

    - #### protected void assertLength(int length, char[] array)

      Asserts that the array of characters has a given length

      Parameters:
        `length` - expected length
        `array` - the array

    - #### protected void assertLength(int length, int[] array)

      Asserts that the array of ints has a given length

      Parameters:
        `length` - expected length
        `array` - the array

    - #### protected void assertLength(int length, Object[] array)

      Asserts that the array of objects has a given length

      Parameters:
        `length` - expected length
        `array` - the array

    - #### protected void assertScript(String script)

      see GroovyAssert.assertScript

    - #### protected void assertToString(Object value, 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

    - #### protected String fixEOLs(String value)

      Returns a copy of a string in which all EOLs are \n.

    - #### public String getMethodName()

    - #### @Override
      public String getName()

      Overload the getName() method to make the test cases look more like AgileDox (thanks to Joe Walnes for this tip!)

    - #### protected String getTestClassName()

    - #### public static boolean notYetImplemented(Object caller)

      see GroovyAssert.notYetImplemented

    - #### public boolean notYetImplemented()

      Convenience method for subclasses of GroovyTestCase, identical to

           GroovyTestCase.notYetImplemented(this);

      .
      Returns:
        `false` when not itself already in the call stack
      See Also:
        notYetImplemented(java.lang.Object)

    - #### protected String shouldFail(Closure code)

      see GroovyAssert.shouldFail

    - #### protected String shouldFail(Class clazz, Closure code)

      see GroovyAssert.shouldFail

    - #### protected String shouldFail(Class clazz, String script)

      see GroovyAssert.shouldFail

    - #### protected String shouldFail(String script)

      see GroovyAssert.shouldFail

    - #### protected String shouldFailWithCause(Class clazz, Closure code)

      see GroovyAssert.shouldFailWithCause