01: package abbot;
02:
03: import java.io.File;
04:
05: import abbot.i18n.Strings;
06: import abbot.script.Step;
07: import abbot.script.Script;
08:
09: /** Indirect usage to avoid too much direct linkage to JUnit. */
10: public class AssertionFailedError extends
11: junit.framework.AssertionFailedError {
12: private File file;
13: private int line;
14:
15: public AssertionFailedError() {
16: }
17:
18: public AssertionFailedError(String msg) {
19: super (msg);
20: }
21:
22: public AssertionFailedError(String msg, Step step) {
23: super (getMessage(msg, step));
24: this .file = Script.getFile(step);
25: this .line = Script.getLine(step);
26: }
27:
28: public File getFile() {
29: return file;
30: }
31:
32: public int getLine() {
33: return line;
34: }
35:
36: private static String getMessage(String msg, Step step) {
37: File file = Script.getFile(step);
38: int line = Script.getLine(step);
39: if (file == null || line <= 0)
40: return msg;
41: return Strings.get("step.failure", new Object[] { msg, file,
42: new Integer(line) });
43: }
44: }
|