/** *Testcallsthemethod.<p> *Has<b>OK</b>statusinthreecases: *<ol> *<li>Anobjecthaslocationstoredin.Thenifmethoddoesnotreturn *null,ithas<b>OK</b>status</li> *<li>Anobjecthasnolocationstoredin.ThenmethodstoreAsURL()is *called,andifurlisnotnullandequalstoaurlwherecomponent *wasstored,methodhas<b>OK</b>status</li> *<li>Anobjecthasnolocationstoredin.ThenmethodstoreAsURL()is *called,andifurlisnullandmethodreturnsnulltoo,method *has<b>OK</b>status</li> *</ol><p> *Thefollowingmethodtestsaretobecompletedsuccessfullybefore: *<ul> *<li><code>storeAsURL()</code>:storestheobject'spersistentdata *toaURLandletstheobjectbecometherepresentationofthisnew *URL</li> *</ul>
*/ publicvoid _getLocation() { if (oObj.hasLocation()) { // if it has location it should know it
tRes.tested("getLocation()", oObj.getLocation() != null);
} else { // else try to obtain location
requiredMethod("storeAsURL()"); if (storeUrl != null) { // if stored successfully - check location
log.println(oObj.getLocation() + "--" + storeUrl);
tRes.tested("getLocation()",
storeUrl.equals(oObj.getLocation()));
} else { // if not - it should not have a location
tRes.tested("getLocation()", oObj.getLocation() == null);
}
}
}
/** *Testcallsthemethod,thenresultischecked.<p> *Has<b>OK</b>statusifstoredurlisnotnullandmethoddoesnot *returnnullorifstoredurlisnullandthemethodreturnsnull.<p> *Thefollowingmethodtestsaretobecompletedsuccessfullybefore: *<ul> *<li><code>storeAsURL()</code>:storestheobject'spersistentdata *toaURLandletstheobjectbecometherepresentationofthisnew *URL</li> *</ul>
*/ publicvoid _hasLocation() {
requiredMethod("storeAsURL()"); if (storeUrl != null) { // if stored successfully - it should have a location
tRes.tested("hasLocation()", oObj.hasLocation());
} else { // if not - it should not
tRes.tested("hasLocation()", !oObj.hasLocation());
}
}
try {
oObj.store();
stored = true;
} catch (IOException e) {
stored = false;
ioE = e;
} if (oObj.hasLocation() && !oObj.isReadonly()) {
tRes.tested("store()", stored); if (!stored) {
log.println("Couldn't store : " + ioE.getMessage());
ioE.printStackTrace(log);
}
} else {
tRes.tested("store()", !stored); if (stored) { if (!oObj.hasLocation()) {
log.println("Shouldn't store successfully"
+ " a document without location");
} else {
log.println("Shouldn't store successfully"
+ " a read-only document");
}
}
}
}
}// finished class _XStorable
Messung V0.5 in Prozent
¤ 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.0.13Bemerkung:
(vorverarbeitet am 2026-10-07)
¤
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.