## jmunit.framework.cldc11
Class TestCase

    java.lang.Object
      javax.microedition.midlet.MIDlet
          jmunit.framework.cldc11.Assertion
              jmunit.framework.cldc11.Test
                  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
Author:
  Brunno

Field Summary

Fields inherited from class jmunit.framework.cldc11.Test
`name, results`

Constructor Summary
`TestCase(int totalOfTests, java.lang.String name)` The default constructor.

Method Summary
`protected void` `addPerformanceMeasurement(PerformanceMeasurement perfMeasurement)` Adds a `PerformanceMeasurement` that wants to measure the performance of one or more tests in this TestCase.
`int` `countTestCases()` Returns the number of tests in TestCase.
`protected void` `endPerformanceMeasurements()` This method ends performance measurements.
`protected void` `removeAllPerformanceMeasurements()` Removes all `PerformanceMeasurement` objects that were observing the performance of a test.
`protected void` `removePerformanceMeasurement(PerformanceMeasurement perfMeasurement)` Removes a `PerformanceMeasurement` that was observing the performance of a test.
`void` `run(TestResult result)` Runs a test and collects its result in a TestResult instance.
`void` `setUp()` A empty method used by the framework to initialize the tests.
`protected void` `startPerformanceMeasurements()` This method starts the performance measurements.
`void` `tearDown()` A empty mehod used by the framework to release resources used by the tests.
`abstract void` `test(int testNumber)` This method stores all the test methods invocation.

Methods inherited from class jmunit.framework.cldc11.Test
`destroyApp, doStart, getName, pauseApp, startApp, test`

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

Methods inherited from class javax.microedition.midlet.MIDlet
`getAppProperty, notifyDestroyed, notifyPaused, 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 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 switch-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 method 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

### run

    public final void run(TestResult result)

  Runs a test and collects its result in a TestResult instance.

  Specified by:
    `run` in class `Test`
  Parameters:
    `result` - The TestResult collecting the results.
  Since:
    JMunit 1.1

### countTestCases

    public int countTestCases()

  Returns the number of tests in TestCase.

  Specified by:
    `countTestCases` in class `Test`
  Since:
    JMunit 1.1

### addPerformanceMeasurement

    protected final void addPerformanceMeasurement(PerformanceMeasurement perfMeasurement)

  Adds a `PerformanceMeasurement` that wants to measure the performance of one or more tests in this TestCase.

  Parameters:
    `perfMeasurement` - The PerformanceMeasurement object to observe the test.
  Since:
    JMunit 1.2

### removePerformanceMeasurement

    protected final void removePerformanceMeasurement(PerformanceMeasurement perfMeasurement)

  Removes a `PerformanceMeasurement` that was observing the performance of a test.

  Parameters:
    `perfMeasurement` - The PerformanceMeasurement object to remove.
  Since:
    JMunit 1.2

### removeAllPerformanceMeasurements

    protected final void removeAllPerformanceMeasurements()

  Removes all `PerformanceMeasurement` objects that were observing the performance of a test.

  Since:
    JMunit 1.2

### startPerformanceMeasurements

    protected final void startPerformanceMeasurements()

  This method starts the performance measurements.

### endPerformanceMeasurements

    protected final void endPerformanceMeasurements()

  This method ends performance measurements. This method should only be called once. Calling this method more than once will be ignored.