static class MyErrorHandler implements ErrorHandler {
static MyErrorHandler _instance = new MyErrorHandler();
+ private List errorMessages = new ArrayList();
+
private MyErrorHandler() {}
public static ErrorHandler getInstance() {
public void handleError(String message) {
log("ErrorHandler.handleWarning("+message+")");
-
+ errorMessages.add(message);
}
public void handleError(String message, Throwable t) {
log("ErrorHandler.handleError("+message+","+t+")");
if (VERBOSE) t.printStackTrace();
+ errorMessages.add(message+","+t+")");
+ }
+
+ public static List/*String*/ getErrorMessages() {
+ return _instance.errorMessages;
}
}
import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
+import org.aspectj.bridge.IMessage;
import org.aspectj.testing.util.FileUtil;
/**
build("PR111779");
}
*/
+
+// public void testPr113531() {
+// initialiseProject("PR113531");
+// build("PR113531");
+// assertFalse("build should have compiled ok",
+// MyTaskListManager.hasErrorMessages());
+// alter("PR113531","inc1");
+// build("PR113531");
+// assertEquals("error message should be 'foo cannot be resolved' ",
+// "foo cannot be resolved",
+// ((IMessage)MyTaskListManager.getErrorMessages().get(0))
+// .getMessage());
+// alter("PR113531","inc2");
+// build("PR113531");
+// assertTrue("There should be no exceptions handled",
+// MyErrorHandler.getErrorMessages().isEmpty());
+// }
// other possible tests: