|
1
|
|
package abbot;
|
|
2
|
|
|
|
3
|
|
import java.io.File;
|
|
4
|
|
|
|
5
|
|
import abbot.i18n.Strings;
|
|
6
|
|
import abbot.script.Step;
|
|
7
|
|
import abbot.script.Script;
|
|
8
|
|
|
|
9
|
|
|
|
10
|
|
public class AssertionFailedError
|
|
11
|
|
extends junit.framework.AssertionFailedError {
|
|
12
|
|
private File file;
|
|
13
|
|
private int line;
|
|
14
|
1
|
public AssertionFailedError() { }
|
|
15
|
2
|
public AssertionFailedError(String msg) { super(msg); }
|
|
16
|
2
|
public AssertionFailedError(String msg, Step step) {
|
|
17
|
2
|
super(getMessage(msg, step));
|
|
18
|
2
|
this.file = Script.getFile(step);
|
|
19
|
2
|
this.line = Script.getLine(step);
|
|
20
|
|
}
|
|
21
|
0
|
public File getFile() { return file; }
|
|
22
|
0
|
public int getLine() { return line; }
|
|
23
|
2
|
private static String getMessage(String msg, Step step) {
|
|
24
|
2
|
File file = Script.getFile(step);
|
|
25
|
2
|
int line = Script.getLine(step);
|
|
26
|
2
|
if (file == null || line <= 0)
|
|
27
|
2
|
return msg;
|
|
28
|
0
|
return Strings.get("step.failure", new Object[] {
|
|
29
|
|
msg, file, new Integer(line)
|
|
30
|
|
});
|
|
31
|
|
}
|
|
32
|
|
}
|
|
33
|
|
|