A test must also define main as follows:

CODE EXAMPLE A-2Definition of main

public static void main(String[] args) { Test t = new <test-class-name>();

Status s = t.run(args, System.err, System.out); s.exit();

}

Defining main in this manner enables the test to also be run standalone, independent of the harness.

Status

Class name: com.sun.tck.cldc.lib.Status

This is a Java ME technology version of the standard harness Status class. It embodies the result of a test, a status-code, and a related message.

MultiTest

Class name: com.sun.tck.cldc.lib.MultiTest

This is a Java ME technology version of the standard harness MultiTest class. It serves as a base class for tests with multiple sub test cases. This base class implements the standard com.sun.tck.cldc.lib.Test features so that you can provide the additional test cases with only a little concern about the boilerplate needed to execute individual test case methods, namely, update the runTestCases() method to add check and invocation statement. MultiTest is designed as a base class used during development of new test classes.

You must add individual test case methods to your derived test class to create a useful test class. Each test case method must take no arguments. If you need to pass an argument into a test method, design a wrapper test case to calculate the argument values and then call the test method with the correct arguments. The test case methods must follow the following convention:

CODE EXAMPLE A-3 Test Case Method

public Status methodName()

78 Java ME TCK Framework Developer’s Guide • July 2007

Page 98
Image 98
Sun Microsystems 1.2 manual Test must also define main as follows, Code Example A-2Definition of main