j.Use the FinalQuestion marker to identify the last question in the sub- interview.

At the end of the sub-interview, have the last question return an instance of FinalQuestion. FinalQuestion is only a marker and does not have question text, More Info, or a getNext method.

The following code in the SampleInterview example identifies the final question in the sub-interview.

Question qXXX = ......... {

Question getNext() { return qEnd;

}

};

Question qEnd = new FinalQuestion(this);

The following SampleInterview.java class is used for the example in the Simple Test Suite. It puts everything together that was described in Step a through Step j.

public class SampleInterview extends Interview {

public SampleInterview(MidpTckBaseInterview parent) throws Fault { super(parent, "sample");

setResourceBundle("i18n");

setHelpSet("help/sampleInterview");

first = new StringQuestion(this, "hello"); first.setExporter( Exporters.getStringValueExporter("sample.string.value")); first.linkTo(end); setFirstQuestion(firstQuestion);

}

private StringQuestion first;

private final FinalQuestion end = new FinalQuestion(this, "end");

}

You can also view the SampleInterview.java file in the following location:

SimpleTestSuite/src/sample/suite

Chapter 3 Test Suite Construction 35

Page 55
Image 55
Sun Microsystems 1.2 manual SimpleTestSuite/src/sample/suite