org.uispec4j
Class UISpecTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.uispec4j.UISpecTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class UISpecTestCase
extends junit.framework.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(java.lang.String testName)
           
 
Method Summary
 Assertion and(Assertion... assertions)
          Returns the intersection of two assertions.
 void assertEquals(boolean expected, Assertion assertion)
          Checks that the given assertion equals the expected parameter.
 void assertEquals(java.lang.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(java.lang.String message, Assertion assertion)
          Checks that the given assertion fails.
 void assertThat(Assertion assertion)
          Checks the given assertion.
 void assertThat(java.lang.String message, Assertion assertion)
          Checks the given assertion.
 void assertTrue(Assertion assertion)
          Checks the given assertion.
 void assertTrue(java.lang.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.
 void setAdapter(UISpecAdapter adapter)
           
protected  void setUp()
          Initializes the resources needed by the test case.
NB: If you provide your own implementation, do not forget to call this one first.
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(java.lang.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(java.lang.String testName)
Method Detail

setAdapter

public void setAdapter(UISpecAdapter adapter)

setUp

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

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

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

Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.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. This method is equivalent to #assertThat(Assertion.

See Also:
UISpecAssert.assertTrue(Assertion)

assertTrue

public void assertTrue(java.lang.String message,
                       Assertion assertion)
Checks the given assertion. If it fails an AssertionFailedError is thrown with the given message. This method is equivalent to #assertThat(String,Assertion.

See Also:
UISpecAssert.assertTrue(String,Assertion)

assertThat

public void assertThat(Assertion assertion)
Checks the given assertion. This method is equivalent to #assertTrue(Assertion.

See Also:
UISpecAssert.assertThat(Assertion)

assertThat

public void assertThat(java.lang.String message,
                       Assertion assertion)
Checks the given assertion. If it fails an AssertionFailedError is thrown with the given message. This method is equivalent to #assertTrue(String,Assertion.

See Also:
UISpecAssert.assertTrue(String,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)

waitUntil

public void waitUntil(java.lang.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(java.lang.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... assertions)
Returns the intersection of two assertions.

See Also:
UISpecAssert.and(Assertion[])

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(java.lang.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-2010. All Rights Reserved.