@Override public void intercept(IMethodInvocation invocation) throws Throwable { AtomicBoolean pass = new AtomicBoolean(false); invocation.getFeature().getFeatureMethod().addInterceptor( new InnerIterationInterceptor(pass, expectedExceptions, reason)); invocation.proceed(); if (pass.get()) { throw assumptionViolation(); } else { throw featurePassedUnexpectedly(); } }
@Override public void intercept(IMethodInvocation invocation) throws Throwable { List<Throwable> throwableList = new ArrayList<>(); for (int i = 0; i <= retry.count(); i++) { Queue<Throwable> throwables = new ConcurrentLinkedQueue<>(); invocation.getFeature().getFeatureMethod().addInterceptor(new InnerRetryInterceptor(retry, condition, throwables)); invocation.proceed(); if (throwables.isEmpty()) { throwableList.clear(); break; } else { throwableList.addAll(throwables); if (retry.delay() > 0) Thread.sleep(retry.delay()); } } if (!throwableList.isEmpty()) { throw new MultipleFailureException(throwableList); } }
@Override public void interceptSetupMethod(IMethodInvocation invocation) throws Throwable { exception = null; beforeTestMethodInvoked = true; manager.beforeTestMethod(invocation.getInstance(), invocation.getFeature().getFeatureMethod().getReflection()); invocation.proceed(); }
@Override public void interceptCleanupMethod(IMethodInvocation invocation) throws Throwable { if (!beforeTestMethodInvoked) { invocation.proceed(); return; } beforeTestMethodInvoked = false; invocation.proceed(); Throwable afterTestMethodEx = null; try { manager.afterTestMethod(invocation.getInstance(), invocation.getFeature().getFeatureMethod().getReflection(), exception); } catch (Throwable t) { afterTestMethodEx = t; } if (afterTestMethodEx != null) { if (exception == null) { throw afterTestMethodEx; } else { exception.addSuppressed(afterTestMethodEx); } } }
@Override public Method getMethod() { return invocation.getFeature().getFeatureMethod().getReflection(); }
@Override public Method getMethod() { return invocation.getFeature().getFeatureMethod().getReflection(); }
@Override public void interceptCleanupMethod(IMethodInvocation invocation) throws Throwable { log.fine("after " + invocation.getFeature().getFeatureMethod().getReflection().getName()); getTestRunner().after(invocation.getTarget(), invocation.getFeature().getFeatureMethod().getReflection(), new InvocationExecutor(invocation)); }
@Override public void interceptSetupMethod(IMethodInvocation invocation) throws Throwable { log.fine("before " + invocation.getFeature().getFeatureMethod().getReflection().getName()); getTestRunner().before(invocation.getTarget(), invocation.getFeature().getFeatureMethod().getReflection(), new InvocationExecutor(invocation)); }
@Override public void interceptCleanupMethod(IMethodInvocation invocation) throws Throwable { log.fine("after " + invocation.getFeature().getFeatureMethod().getReflection().getName()); getTestRunner().after(invocation.getTarget(), invocation.getFeature().getFeatureMethod().getReflection(), new InvocationExecutor(invocation)); }
@Override public void interceptSetupMethod(IMethodInvocation invocation) throws Throwable { log.fine("before " + invocation.getFeature().getFeatureMethod().getReflection().getName()); getTestRunner().before(invocation.getTarget(), invocation.getFeature().getFeatureMethod().getReflection(), new InvocationExecutor(invocation)); }