I want to execute a block of code that changes based on a pass or a fail. Basically looking to set the results from a test in our test case tracking software. I created my own test rules, shown below, but no matter if the test passes or fails it always just calls succeeded.
public class TestRules extends TestWatcher {
@Override
public void succeeded(Description description){
log.error("This should only be called when passing");
}
@Override
public void failed(Throwable e, Description description) {
log.error("This Should only be called when Failing");
}
}
I set the rule in the test as follows
@Rule
public TestRules testRules = new TestRules()
I am hoping I am just missing something stupid and simple.