/* *Testthevaluesoflocation()
*/
loc = getLocation("AbstractLocationTarg", "foo"); if (loc != null) {
failure("location of AbstractLocationTarg.foo() should have " + "been null, but was: " + loc);
}
loc = getLocation("java.util.List", "clear"); if (loc != null) {
failure("location of java.util.List.clear() " + "should have been null, but was: " + loc);
}
loc = getLocation("java.lang.Object", "getClass"); if (loc == null) {
failure("location of Object.getClass() " + "should have been non-null, but was: " + loc);
} else { if (!loc.declaringType().name().equals("java.lang.Object")) {
failure("location.declaringType() of Object.getClass() " + "should have been java.lang.Object, but was: " +
loc.declaringType());
} if (!loc.method().name().equals("getClass")) {
failure("location.method() of Object.getClass() " + "should have been getClass, but was: " +
loc.method());
} if (loc.codeIndex() != -1) {
failure("location.codeIndex() of Object.getClass() " + "should have been -1, but was: " +
loc.codeIndex());
} if (loc.lineNumber() != -1) {
failure("location.lineNumber() of Object.getClass() " + "should have been -1, but was: " +
loc.lineNumber());
}
}
Location mainLoc = getLocation("LocationTarg", "main");
loc = getLocation("LocationTarg", "foo"); if (loc == null) {
failure("location of LocationTarg.foo() " + "should have been non-null, but was: " + loc);
} else { if (!loc.declaringType().name().equals("LocationTarg")) {
failure("location.declaringType() of LocationTarg.foo() " + "should have been LocationTarg, but was: " +
loc.declaringType());
} if (!loc.method().name().equals("foo")) {
failure("location.method() of LocationTarg.foo() " + "should have been foo, but was: " +
loc.method());
} if (loc.codeIndex() != 0) { // implementation dependent!!!
failure("location.codeIndex() of LocationTarg.foo() " + "should have been 0, but was: " +
loc.codeIndex());
} if (loc.lineNumber() != (mainLoc.lineNumber() + 3)) {
failure("location.lineNumber() of LocationTarg.foo() " + "should have been " + (mainLoc.lineNumber() + 3) + ", but was: " + loc.lineNumber());
}
}
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.