groovy.util

## Class GroovyTestCase

- java.lang.Object
- - junit.framework.Assert
  - - junit.framework.TestCase
    - - groovy.util.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`.
  Author:
    bob mcwhirter, James Strachan, Dierk Koenig (the notYetImplemented feature, changes to shouldFail), Andre Steingress
  See Also:
    `GroovyAssert`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.util.logging.Logger` | `log`
    `static java.lang.String` | `TEST_SCRIPT_NAME_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroovyTestCase()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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)` see `GroovyAssert.assertScript(String)`
    `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)` see `GroovyAssert.notYetImplemented(java.lang.Object)`
    `protected java.lang.String` | `shouldFail(java.lang.Class clazz, Closure code)` see `GroovyAssert.shouldFail(Class, groovy.lang.Closure)`
    `protected java.lang.String` | `shouldFail(java.lang.Class clazz, java.lang.String script)` see `GroovyAssert.shouldFail(Class, String)`
    `protected java.lang.String` | `shouldFail(Closure code)` see `GroovyAssert.shouldFail(groovy.lang.Closure)`
    `protected java.lang.String` | `shouldFail(java.lang.String script)` see `GroovyAssert.shouldFail(String)`
    `protected java.lang.String` | `shouldFailWithCause(java.lang.Class clazz, Closure code)` see `GroovyAssert.shouldFailWithCause(Class, groovy.lang.Closure)`

    - ### Methods inherited from class junit.framework.TestCase

      `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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### log

          protected static java.util.logging.Logger log

    - #### TEST_SCRIPT_NAME_PREFIX

          public static final java.lang.String TEST_SCRIPT_NAME_PREFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GroovyTestCase

          public GroovyTestCase()

  - ### Method Detail

    - #### getName

          public 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:
        `getName` in class `junit.framework.TestCase`

    - #### getMethodName

          public java.lang.String getMethodName()

    - #### assertArrayEquals

          protected void assertArrayEquals(java.lang.Object[] expected,
                                           java.lang.Object[] value)

      Asserts that the arrays are equivalent and contain the same values
      Parameters:
        `expected` -
        `value` -

    - #### assertLength

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

      Asserts that the array of characters has a given length
      Parameters:
        `length` - expected length
        `array` - the array

    - #### assertLength

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

      Asserts that the array of ints has a given length
      Parameters:
        `length` - expected length
        `array` - the array

    - #### assertLength

          protected 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

    - #### assertContains

          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

    - #### assertContains

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

      Asserts that the array of ints contains a given int
      Parameters:
        `expected` - expected int
        `array` - the array

    - #### assertToString

          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
      Parameters:
        `value` - the object to be output to the console
        `expected` - the expected String representation

    - #### assertInspect

          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
      Parameters:
        `value` - the object to be output to the console
        `expected` - the expected String representation

    - #### assertScript

          protected void assertScript(java.lang.String script)
                               throws java.lang.Exception

      see `GroovyAssert.assertScript(String)`
      Throws:
        `java.lang.Exception`

    - #### getTestClassName

          protected java.lang.String getTestClassName()

    - #### shouldFail

          protected java.lang.String shouldFail(Closure code)

      see `GroovyAssert.shouldFail(groovy.lang.Closure)`

    - #### shouldFail

          protected java.lang.String shouldFail(java.lang.Class clazz,
                                                Closure code)

      see `GroovyAssert.shouldFail(Class, groovy.lang.Closure)`

    - #### shouldFailWithCause

          protected java.lang.String shouldFailWithCause(java.lang.Class clazz,
                                                         Closure code)

      see `GroovyAssert.shouldFailWithCause(Class, groovy.lang.Closure)`

    - #### shouldFail

          protected java.lang.String shouldFail(java.lang.Class clazz,
                                                java.lang.String script)

      see `GroovyAssert.shouldFail(Class, String)`

    - #### shouldFail

          protected java.lang.String shouldFail(java.lang.String script)

      see `GroovyAssert.shouldFail(String)`

    - #### fixEOLs

          protected java.lang.String fixEOLs(java.lang.String value)

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

    - #### notYetImplemented

          public static boolean notYetImplemented(java.lang.Object caller)

      see `GroovyAssert.notYetImplemented(java.lang.Object)`

    - #### 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)`

    - #### assertEquals

          public static void assertEquals(java.lang.String message,
                                          java.lang.Object expected,
                                          java.lang.Object actual)

    - #### assertEquals

          public static void assertEquals(java.lang.Object expected,
                                          java.lang.Object actual)

    - #### assertEquals

          public static void assertEquals(java.lang.String expected,
                                          java.lang.String actual)