You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want that exercise AbstractClass (and others in the future with this kind) to be more "tolerant" to students errors, here are a few tips on how to do it with an example :
Replace all .class invocations by Class.forName() (that is what causes students to see message "You modified ..." )
try {
StringclassNameWithPackage = "templates.Shape";
ClassshapeClass = Class.forName(classNameWithPackage);
Methodmy_method = shapeClass.getDeclaredMethod("getArea", double.class);
// ... Some piece of code later ...thrownewCustomGradingResult(TestStatus.SUCCESS,1, "You defined a class Shape with a method called getArea")
} catch(ClassNotFoundExceptionerr) {
thrownewCustomGradingResult(TestStatus.FAILED, 0, "Shape class not found");
} catch(NoSuchMethodErrorerr) {
thrownewCustomGradingResult(TestStatus.FAILED, 0, "Shape method getArea cannot be found");
} catch(Exceptionerr) {
if (errinstanceofCustomGradingResult) {
throwerr;
}
thrownewCustomGradingResult(TestStatus.FAILED, 0, "Unexpected error");
}
PS: As I'm busy with work, I can't make any PR for a long time.
The text was updated successfully, but these errors were encountered:
Hello @AlexandreDubray,
If you want that exercise AbstractClass (and others in the future with this kind) to be more "tolerant" to students errors, here are a few tips on how to do it with an example :
Example :
PS: As I'm busy with work, I can't make any PR for a long time.
The text was updated successfully, but these errors were encountered: