a.Create a class (SampleInterview) that is a subtype of the Interview class.

The following code creates the SampleInterview class.

public class SampleInterview extends Interview {

....

}

b.Identify the new interview (SampleInterview) as a sub-interview of the parent interview.

In the new sub-interview class, the constructor must take a reference to the parent interview as an argument and pass this reference to the superclass constructor. This identifies the interview as a sub-interview of the parent interview.

The following code identifies SampleInterview as a sub-interview of

MidpTckBaseInterview.

public class SampleInterview extends Interview {

public SampleInterview(MidpTckBaseInterview parent) throws Fault {

super(parent, "sample");

}

c.(Optional) Identify the resource file and helpset file used by the sub- interview.

By default, a sub-interview shares a resource file and More Info help files with its parent interview. However, you can choose to use a different resource file and helpset file.

The following code in the SampleInterview example specifies a different resource file and helpset file.

public class SampleInterview extends Interview { public SampleInterview(MidpTckBaseInterview parent)

throws Fault { super(parent, "sample"); setResourceBundle("i18n"); setHelpSet("help/sampleInterview");

}

}

In the example, "i18n" is the properties file updated in Step 4, and sampleInterview is the More Info helpset file updated in Step 5.

Chapter 3 Test Suite Construction 31

Page 51
Image 51
Sun Microsystems 1.2 manual Following code creates the SampleInterview class