blob: d2b3e94ef5ad57cfde22f2a014086ed8a0997236 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package cz.crcs.ectester.common.test;
/**
* @param <T>
* @author Jan Jancar johny@neuromancer.sk
*/
public abstract class SimpleTest<T extends BaseTestable> extends Test implements Testable {
protected T testable;
protected TestCallback<T> callback;
public SimpleTest(T testable, TestCallback<T> callback) {
if (testable == null) {
throw new IllegalArgumentException("testable is null.");
}
if (callback == null) {
throw new IllegalArgumentException("callback is null.");
}
this.testable = testable;
this.callback = callback;
}
public T getTestable() {
return testable;
}
@Override
protected void runSelf() {
testable.run();
result = callback.apply(testable);
}
@Override
public SimpleTest clone() throws CloneNotSupportedException {
SimpleTest clone = (SimpleTest) super.clone();
clone.testable = testable.clone();
return clone;
}
}
|