You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
package foundation.pEp.pitytest.examples.ctxinitfail;
|
|
|
|
import static foundation.pEp.pitytest.TestLogger.*;
|
|
|
|
import foundation.pEp.pitytest.*;
|
|
|
|
|
|
class CtxInitFailContext extends AbstractTestContext {
|
|
String name;
|
|
int result;
|
|
|
|
@Override
|
|
public CtxInitFailContext init() throws RuntimeException {
|
|
name = "PityTest";
|
|
log("Hello World from: " + name);
|
|
// throw new RuntimeException("regddjkl");
|
|
result = 50 / 0;
|
|
|
|
return this;
|
|
}
|
|
}
|
|
|
|
class TestMain {
|
|
public static void main(String[] args) throws Exception {
|
|
TestSuite.getDefault().setVerbose(true);
|
|
|
|
new TestUnit<CtxInitFailContext>("ctxinitfail1", new CtxInitFailContext(), ctx -> {
|
|
// do stuff using the context
|
|
// throw or assert, to let a testunit fail
|
|
log("Hello World from: " + ctx.name);
|
|
});
|
|
|
|
new TestUnit<CtxInitFailContext>("ctxinitfail1", new CtxInitFailContext(), ctx -> {
|
|
// do stuff using the context
|
|
// throw or assert, to let a testunit fail
|
|
log("Hello World from: " + ctx.name);
|
|
});
|
|
|
|
CtxInitFailContext failingContext = new CtxInitFailContext();
|
|
|
|
new TestUnit<CtxInitFailContext>("ctxinitfail2", failingContext, ctx -> {
|
|
// do stuff using the context
|
|
// throw or assert, to let a testunit fail
|
|
log("Hello World from: " + ctx.name);
|
|
});
|
|
|
|
new TestUnit<CtxInitFailContext>("ctxinitfail3", failingContext, ctx -> {
|
|
// do stuff using the context
|
|
// throw or assert, to let a testunit fail
|
|
log("Hello World from: " + ctx.name);
|
|
});
|
|
|
|
new TestUnit<CtxInitFailContext>("ctxinitfail4", failingContext, ctx -> {
|
|
// do stuff using the context
|
|
// throw or assert, to let a testunit fail
|
|
log("Hello World from: " + ctx.name);
|
|
});
|
|
|
|
TestSuite.getDefault().run();
|
|
}
|
|
}
|
|
|
|
|
|
|