jmunit.framework.cldc11
Class GuiListener

java.lang.Object
  extended by jmunit.framework.cldc11.GuiListener
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener, TestListener

public class GuiListener
extends java.lang.Object
implements TestListener, javax.microedition.lcdui.CommandListener

The GuiListener class displays the results of running a test as a green/red bar together with the number of tests, failures and errors and the running time.

Since:
JMUnit 1.1.
Author:
C.A. Meijer

Constructor Summary
GuiListener(Test testMidlet)
           
 
Method Summary
 void addError(java.lang.Class testClass, java.lang.String test, java.lang.Throwable t)
          Appends the error to the list of failed test cases.
 void addFailure(java.lang.Class testClass, java.lang.String test, AssertionFailedException t)
          Appends the failure to the list of failed test cases.
 void clear()
          Clears the status of any previous test runs.
 void commandAction(javax.microedition.lcdui.Command cmd, javax.microedition.lcdui.Displayable disp)
          Responds to a user command.
 void endTest(java.lang.Class testClass, java.lang.String test)
          Refreshes the display to indicate that a test has finished running.
 int getNumberCompletedTests()
          Returns the number of tests that have been run.
 int getNumberErrors()
          Returns the number of errors reported.
 int getNumberFailures()
          Returns the number of failures reported.
 int getNumberSuccessful()
          Returns the number successful tests run.
 int getNumberTests()
          Returns the total number of tests in the test suite.
 long getRunningTime()
          Returns how long the tests have taken to run.
 void startTest(java.lang.Class testClass, java.lang.String test)
          The GuiListener ignores the fact that a test has started running.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiListener

public GuiListener(Test testMidlet)
Parameters:
testMidlet -
Method Detail

addError

public void addError(java.lang.Class testClass,
                     java.lang.String test,
                     java.lang.Throwable t)
Appends the error to the list of failed test cases.

Specified by:
addError in interface TestListener
Parameters:
testClass - The Class associated with the test.
test - The test.
t - The error.

addFailure

public void addFailure(java.lang.Class testClass,
                       java.lang.String test,
                       AssertionFailedException t)
Appends the failure to the list of failed test cases.

Specified by:
addFailure in interface TestListener
Parameters:
testClass - The Class associated with the test.
test - The test.
t - The failure.

endTest

public void endTest(java.lang.Class testClass,
                    java.lang.String test)
Refreshes the display to indicate that a test has finished running.

Specified by:
endTest in interface TestListener
Parameters:
testClass - The Class associated with the test.
test - The test case that finished running.

startTest

public void startTest(java.lang.Class testClass,
                      java.lang.String test)
The GuiListener ignores the fact that a test has started running.

Specified by:
startTest in interface TestListener
Parameters:
testClass - The Class associated with the test.
test - The test that started.

getNumberTests

public int getNumberTests()
Returns the total number of tests in the test suite.

Returns:
The total number of tests.

getNumberErrors

public int getNumberErrors()
Returns the number of errors reported.

Returns:
The number of errors.

getNumberCompletedTests

public int getNumberCompletedTests()
Returns the number of tests that have been run.

Returns:
The number of tests.

getNumberFailures

public int getNumberFailures()
Returns the number of failures reported.

Returns:
The number of failures.

getNumberSuccessful

public int getNumberSuccessful()
Returns the number successful tests run.

Returns:
The number of successful tests.

getRunningTime

public long getRunningTime()
Returns how long the tests have taken to run.

Returns:
The running time.

commandAction

public void commandAction(javax.microedition.lcdui.Command cmd,
                          javax.microedition.lcdui.Displayable disp)
Responds to a user command.

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Parameters:
cmd - The command.
disp - The display.

clear

public void clear()
Clears the status of any previous test runs.

Specified by:
clear in interface TestListener