org.uispec4j
Class UISpecTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.uispec4j.UISpecTestCase
All Implemented Interfaces:
Test

public abstract class UISpecTestCase
extends TestCase

UISpec4J-enabled TestCase class.

Test cases derived from this class automatically set up the instanciation mechanism. They can also access the application main window by defining an adapter, i.e. a class implementing the UISpecAdapter class.
The adapter can be set from the test setUp() or any test method using the setAdapter(UISpecAdapter) method. The adapter can also be registered by setting the uispec4j.adapter property as follows:


 uispec4j.adapter=samples.addressbook.test.Adapter
 


Constructor Summary
protected UISpecTestCase()
           
protected UISpecTestCase(String testName)
           
 
Method Summary
 Assertion and(Assertion[] assertions)
          Returns the intersection of two assertions.
 Assertion and(Assertion assertion1, Assertion assertion2)
          Returns the intersection of two assertions.
 void assertEquals(boolean expected, Assertion assertion)
          Checks that the given assertion equals the expected parameter.
 void assertEquals(String message, boolean expected, Assertion assertion)
          Checks that the given assertion equals the expected parameter.
 void assertFalse(Assertion assertion)
          Checks that the given assertion fails.
 void assertFalse(String message, Assertion assertion)
          Checks that the given assertion fails.
 void assertTrue(Assertion assertion)
          Checks the given assertion.
 void assertTrue(String message, Assertion assertion)
          Checks the given assertion.
 Window getMainWindow()
          Returns the Window created by the adapter.
 Assertion not(Assertion assertion)
          Returns a negation of the given assertion.
 Assertion or(Assertion[] assertions)
          Returns the union of two assertions.
 Assertion or(Assertion assertion1, Assertion assertion2)
          Returns the union of two assertions.
 void setAdapter(UISpecAdapter adapter)
           
protected  void setUp()
          Initializes the resources needed by the test case.
protected  void tearDown()
          Checks whether an unexpected exception had occurred, and releases the test resources.
 void waitUntil(Assertion assertion, long waitTimeLimit)
          Waits for at most 'waitTimeLimit' ms until the assertion is true.
 void waitUntil(String message, Assertion assertion, long waitTimeLimit)
          Waits for at most 'waitTimeLimit' ms until the assertion is true.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UISpecTestCase

protected UISpecTestCase()

UISpecTestCase

protected UISpecTestCase(String testName)
Method Detail

setAdapter

public void setAdapter(UISpecAdapter adapter)

setUp

protected void setUp()
              throws Exception
Initializes the resources needed by the test case.
NB: If you provide your own implementation, do not forget to call this one first.

Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Checks whether an unexpected exception had occurred, and releases the test resources.

Throws:
Exception

getMainWindow

public Window getMainWindow()
                     throws org.uispec4j.UISpecTestCase.AdapterNotFoundException
Returns the Window created by the adapter.

Throws:
AdapterNotFoundException - if the uispec4j.adapter property does not refer to a valid adapter
org.uispec4j.UISpecTestCase.AdapterNotFoundException

assertTrue

public void assertTrue(Assertion assertion)
Checks the given assertion.

See Also:
UISpecAssert.assertTrue(Assertion)

waitUntil

public void waitUntil(Assertion assertion,
                      long waitTimeLimit)
Waits for at most 'waitTimeLimit' ms until the assertion is true.

See Also:
UISpecAssert.waitUntil(Assertion, long)

assertFalse

public void assertFalse(Assertion assertion)
Checks that the given assertion fails.

See Also:
UISpecAssert.assertFalse(Assertion)

assertTrue

public void assertTrue(String message,
                       Assertion assertion)
Checks the given assertion. If it fails an AssertionFailedError is thrown with the given message.

See Also:
UISpecAssert.assertTrue(String, Assertion)

waitUntil

public void waitUntil(String message,
                      Assertion assertion,
                      long waitTimeLimit)
Waits for at most 'waitTimeLimit' ms until the assertion is true. If it fails an AssertionFailedError is thrown with the given message.

See Also:
UISpecAssert.waitUntil(String, Assertion, long)

assertFalse

public void assertFalse(String message,
                        Assertion assertion)
Checks that the given assertion fails. If it succeeds an AssertionFailedError is thrown with the given message.

See Also:
UISpecAssert.assertFalse(String, Assertion)

not

public Assertion not(Assertion assertion)
Returns a negation of the given assertion.

See Also:
UISpecAssert.not(Assertion)

and

public Assertion and(Assertion assertion1,
                     Assertion assertion2)
Returns the intersection of two assertions.

See Also:
UISpecAssert.and(Assertion[])

and

public Assertion and(Assertion[] assertions)
Returns the intersection of two assertions.

See Also:
UISpecAssert.and(Assertion[])

or

public Assertion or(Assertion assertion1,
                    Assertion assertion2)
Returns the union of two assertions.


or

public Assertion or(Assertion[] assertions)
Returns the union of two assertions.

See Also:
UISpecAssert.or(Assertion[])

assertEquals

public void assertEquals(boolean expected,
                         Assertion assertion)
Checks that the given assertion equals the expected parameter.

See Also:
UISpecAssert.assertEquals(boolean, Assertion)

assertEquals

public void assertEquals(String message,
                         boolean expected,
                         Assertion assertion)
Checks that the given assertion equals the expected parameter. If it fails an AssertionFailedError is thrown with the given message.

See Also:
UISpecAssert.assertEquals(String, boolean, Assertion)


Copyright © 2004-2007 Design-up. All Rights Reserved.