// waiting a little bit for data transferred
util.utils.pause(200); try { Thread.sleep(200);
} catch (InterruptedException e) { thrownew StatusException(e, Status.failed(e.getMessage()));
}
}
/** *Tests<code>removeListener()</code>.Before,itensuresthatother *testsareperformedandthat<code>addListener()</code>isokay.Then, *calls<code>XActiveDataControl.start()</code>andchecksthatnomethod *ofthelistenerwascalled.
*/ publicvoid _removeListener() { // performing other tests before, so, that don't break them try {
executeMethod("terminate()");
} catch (StatusException e) { // the result doesn't matter
}
// check that addListener() is okay
requiredMethod("addListener()");
// removing the listener
oObj.removeListener(listener);
// starting the activity
oObj.start();
// wait a little bit to allow for listeners to be called try { Thread.sleep(200);
} catch (InterruptedException e) { thrownew StatusException(e, Status.failed(e.getMessage()));
}
// check that no removed listener's method was called
tRes.tested("removeListener()",!startCalled &&
!terminateCalled && !errorCalled && !smthngElseCalled) ;
}
/** *Tests<code>terminate()</code>.First,ensuresthat<code>start()</code> *hasbeencalled.Then,verifies<code>start()</code>, *<code>addListener()</code>and<code>terminate()</code>results,by *checkingthattheappropriatelistener'smethodshavebeencalled.
*/ publicvoid _terminate() { // ensuring that the activity has been started
executeMethod("start()");
// terminating the activity
oObj.terminate();
// waiting a little bit for listeners to be called try { Thread.sleep(200);
} catch (InterruptedException e) { thrownew StatusException(e, Status.failed(e.getMessage()));
}
// check, if any error occurred if (errorCalled) {
log.println("Unexpected error " + error);
((Exception)error).printStackTrace(log);
}
// verification of start() method - startedCalled method should be // called if (!tRes.tested("start()", startCalled)) {
log.println("XStreamListener.started() was not called()");
}
// check that any listener method is called
tRes.tested("addListener()", startCalled ||
terminateCalled || errorCalled || smthngElseCalled);
// checking that terminated() has been called or streams were closed // before terminate() call, in this case termination has no sense.
tRes.tested("terminate()", terminateCalled || closeCalled);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.