@Override public Class<? extends Throwable>[] getDeclaredFailFastExceptions() { FailFast failFastAnnotation = fixtureClass.getAnnotation(FailFast.class); Class<? extends Throwable>[] failFastExceptions = failFastAnnotation.onExceptionType(); return failFastExceptions; }
@RunWith(ConcordionRunner.class) @FailFast public class FailFastFixture { private boolean myMethodWasCalled = false; public boolean myMethodWasCalledProcessing(String fragment) { new TestRig() .withFixture(this) .processFragment(fragment); return myMethodWasCalled; } public void myExceptionThrower() { throw new RuntimeException("Thrown by myExceptionThrower"); } public void myMethod() { myMethodWasCalled = true; } }
@RunWith(ConcordionRunner.class) @FailFast(onExceptionType={RuntimeException.class, IOException.class}) public class FailFastOnSpecificExceptionsFixture { private boolean myMethodWasCalled; public boolean myMethodWasCalledProcessing(String fragment) { myMethodWasCalled = false; new TestRig() .withFixture(this) .processFragment(fragment); return myMethodWasCalled; } public void myTimeoutExceptionThrower() throws TimeoutException { throw new TimeoutException("Thrown by myTimeoutExceptionThrower"); } public void myFileNotFoundExceptionThrower() throws FileNotFoundException { throw new FileNotFoundException("Thrown by myFileNotFoundExceptionThrower"); } public void myMethod() { myMethodWasCalled = true; } }
@Override public Class<? extends Throwable>[] getDeclaredFailFastExceptions() { FailFast failFastAnnotation = fixtureClass.getAnnotation(FailFast.class); Class<? extends Throwable>[] failFastExceptions = failFastAnnotation.onExceptionType(); return failFastExceptions; }
@RunWith(ConcordionRunner.class) @FullOGNL @FailFast public class FailFastExampleFixture { private int counter = 0; public int getCounter() { return counter; } public void throwException() throws Exception{ throw new Exception(); } }