GriffonUnitTestCase (Griffon 0.9.5-rc2)
Date: 2012-03-09

Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## griffon.test
[Groovy] Class GriffonUnitTestCase

    java.lang.Object
      GroovyTestCase
          griffon.test.GriffonUnitTestCase

    class GriffonUnitTestCase
    extends GroovyTestCase

Support class for writing unit tests in Griffon. It mainly provides access to various mocking options, while making sure that the meta- class magic does not leak outside of a single test. It also provides access to the threading facilities exposed by `UIThreadManager`.

Property Summary
`def` | `execAsync` Executes code asynchronously inside the UI thread
`def` | `execFuture` Schedules a block of code as a Future
`def` | `execOutside` Executes code outside the UI thread
`def` | `execSync` Executes code synchronously inside the UI thread
`def` | `isUIThread` True if the current thread is the UI thread
`Map` | `savedMetaClasses`

Constructor Summary
`GriffonUnitTestCase()`

Method Summary
`protected GriffonMock` | `mockFor(Class clazz, boolean loose = false)` Creates a new Griffon mock for the given class.
`protected void` | `registerMetaClass(Class clazz)` Use this method when you plan to perform some meta-programming on a class.
`protected void` | `setUp()`
`protected void` | `tearDown()`

Property Detail

### execAsync

    def execAsync

  Executes code asynchronously inside the UI thread

### execFuture

    def execFuture

  Schedules a block of code as a Future

### execOutside

    def execOutside

  Executes code outside the UI thread

### execSync

    def execSync

  Executes code synchronously inside the UI thread

### isUIThread

    def isUIThread

  True if the current thread is the UI thread

### savedMetaClasses

    Map savedMetaClasses

Constructor Detail

### GriffonUnitTestCase

    GriffonUnitTestCase()

Method Detail

### mockFor

    protected GriffonMock mockFor(Class clazz, boolean loose = false)

  Creates a new Griffon mock for the given class. Use it as you would use MockFor and StubFor.
  Parameters:
    `clazz` - The class to mock.
    `loose` - If `true`, the method returns a loose- expectation mock, otherwise it returns a strict one. The default is a strict mock.

### registerMetaClass

    protected void registerMetaClass(Class clazz)

  Use this method when you plan to perform some meta-programming on a class. It ensures that any modifications you make will be cleared at the end of the test.
  Parameters:
    `clazz` - The class to register.

### setUp

    protected void setUp()

### tearDown

    protected void tearDown()

Groovy Documentation