Sun Microsystems 1.2 Telephone Accessories User Manual


 
68 Java ME TCK Framework Developer’s Guide July 2007
For example, the following test requires a Duke.png to create the Image object for
successful execution.
For this test example, the following is a resources entry that might be added to the
test description file.
In the resources entry, the value of the resource
(shared/sample/pkg3/Duke.png) is the qualified name of the resource file. If
multiple resources are added to the test description file, separate them with white
space. If the resource file is a class file, the file name must include the .class
extension.
During build time, the Duke.png image file is copied into the specified destination
directory (../shared/sample/pkg3/Duke.png). During test execution, the
execution framework checks the testClasses.lst file and the test URL. During
the test execution, the framework bundles the resource files specified in the
resource entry (../shared/sample/pkg3/Duke.png) and the class files listed
in testClasses.lst into a test JAR file.
CODE EXAMPLE 4-22 Test That Requires an Image Resource
Public class Test2 {
public Status testImage() {
Image imgI = null;
String imageDir = "/shared/sample/pkg3/";
try {
imgI = Image.createImage(imageDir+"Duke.png");
} catch (IOException e) {
....
}
if (imgI == null) {
return Status.failed("Failed: no image is created.");
}
return Status.passed("OKAY");
}
}
CODE EXAMPLE 4-23 resources Attribute in the Test Description
<TR>
<TD SCOPE="row"> <B>resources</B> </TD>
<TD>shared/sample/pkg3/Duke.png</TD>
</TR>