jmunit.framework.cldc11
Class TestCase

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by jmunit.framework.cldc11.Assertion
          extended by jmunit.framework.cldc11.AdvancedAssertion
              extended by jmunit.framework.cldc11.Test
                  extended by jmunit.framework.cldc11.TestCase

public abstract class TestCase
extends Test

The principal class in the framework. All your test classes must extend this one. It's purpose is to encapsulate all the tests methods of the application or a specific group of them. The framework then use it to execute all.

Since:
JMUnit 1.0

Field Summary
 
Fields inherited from class jmunit.framework.cldc11.Test
screen
 
Constructor Summary
TestCase(int totalOfTests, java.lang.String name)
          The default constructor.
 
Method Summary
 void setUp()
          A empty mehod used by the framework to initialize the tests.
 void tearDown()
          A empty mehod used by the framework to release resources used by the tests.
 void test()
          The test method executes all the tests.
abstract  void test(int testNumber)
          This method stores all the test methods invocation.
 
Methods inherited from class jmunit.framework.cldc11.Test
destroyApp, pauseApp, setScreen, startApp
 
Methods inherited from class jmunit.framework.cldc11.Assertion
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail, fail, fail, fail, fail, fail, fail, fail, fail, fail
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestCase

public TestCase(int totalOfTests,
                java.lang.String name)
The default constructor. It just transmits the necessary informations to the superclass.

Parameters:
totalOfTests - the total of test methods present in the class.
name - this testcase's name.
Since:
JMUnit 1.0
Method Detail

test

public final void test()
The test method executes all the tests. In each test, it first executes the setUp() method, and after the test, it records the result and execute the tearDown() method. The developer must put the rigth number of tests in the constructor, otherwise this method may not work properly. It uses the test(int testNumber) method to execute each one, so it's important to create it correctly.

Specified by:
test in class Test
Since:
JMUnit 1.0

test

public abstract void test(int testNumber)
                   throws java.lang.Throwable
This method stores all the test methods invocation. The developer must implement this method with a swith-case. The cases must start from 0 and increase in steps of one until the number declared as the total of tests in the constructor, exclusive. For example, if the total is 3, the cases must be 0, 1 and 2. In each case, there must be a test method invocation.

Parameters:
testNumber - the test to be executed.
Throws:
java.lang.Throwable - anything that the executed test can throw.
Since:
JMUnit 1.0

setUp

public void setUp()
           throws java.lang.Throwable
A empty mehod used by the framework to initialize the tests. If there's 5 test methods, the setUp is called 5 times, one for each method. The setUp occurs before the method's execution, so the developer can use it to any necessary initialization. It's necessary to override it, however.

Throws:
java.lang.Throwable - anything that the initialization can throw.
Since:
JMUnit 1.0

tearDown

public void tearDown()
A empty mehod used by the framework to release resources used by the tests. If there's 5 test methods, the tearDown is called 5 times, one for each method. The tearDown occurs after the method's execution, so the developer can use it to close something used in the test, like a InputStream or the RMS. It's necessary to override it, however.

Since:
JMUnit 1.0