public void stopGlobalExtensions() { for (IGlobalExtension extension : globalExtensions) { extension.stop(); } }
public void startGlobalExtensions() { for (IGlobalExtension extension : globalExtensions) { extension.start(); } }
@Override public void evaluate() throws Throwable { invocation.proceed(); } };
@Override public void interceptInitializerMethod(IMethodInvocation invocation) throws Throwable { injectValues(invocation.getInstance(), false, (Specification)invocation.getInstance()); invocation.proceed(); }
@Override public void interceptSharedInitializerMethod(IMethodInvocation invocation) throws Throwable { createInjector(); injectValues(invocation.getSharedInstance(), true, (Specification)invocation.getInstance()); invocation.proceed(); }
@Override public void interceptSharedInitializerMethod(IMethodInvocation invocation) throws Throwable { runBeforeRegistryCreatedMethods((Specification) invocation.getSharedInstance()); createAndStartupRegistry(); injectServices(invocation.getSharedInstance(), true); invocation.proceed(); }
@Override public void intercept(IMethodInvocation invocation) throws Throwable { try { invocation.proceed(); } catch (AssertionError e) { throw assumptionViolation(); } catch (Throwable e) { if (isExpected(e)) { throw assumptionViolation(); } else { throw e; } } throw featurePassedUnexpectedly(); }
/** * Returns the current {@code Specification} instance. * * @return the current {@code Specification} instance */ public Object getInstance() { return invocation.getInstance(); }
private IGlobalExtension instantiateGlobalExtension(Class<?> clazz) { try { return (IGlobalExtension) clazz.newInstance(); } catch (Exception e) { throw new ExtensionException("Failed to instantiate extension '%s'", e).withArgs(clazz.getName()); } }
private Object evaluateCondition(Closure condition) { condition.setDelegate(new PreconditionContext()); condition.setResolveStrategy(Closure.DELEGATE_ONLY); try { return condition.call(); } catch (Exception e) { throw new ExtensionException("Failed to evaluate @Requires condition", e); } } }
private void runGlobalExtensions() { for (IGlobalExtension extension : extensionRegistry.getGlobalExtensions()) { extension.visitSpec(spec); } }
@Override public void interceptInitializerMethod(IMethodInvocation invocation) throws Throwable { injectServices(invocation.getInstance(), false); invocation.proceed(); }
public Void doCall(Object[] args) throws Throwable { invocation.proceed(); return null; } });
@Override public void intercept(final IMethodInvocation invocation) throws Throwable { DefaultGroovyMethods.use(null, categories, new Closure<Void>(invocation.getInstance(), invocation.getInstance()) { public Void doCall(Object[] args) throws Throwable { invocation.proceed(); return null; } }); } }
private void verifyGlobalExtension(Class<?> clazz) { if (!IGlobalExtension.class.isAssignableFrom(clazz)) throw new ExtensionException( "Class '%s' is not a valid global extension because it is not derived from '%s'" ).withArgs(clazz.getName(), IGlobalExtension.class.getName()); }
@Override public void interceptInitializerMethod(IMethodInvocation invocation) throws Throwable { invocation.proceed(); // needs to run before so that mocks are already initialized manager.prepareTestInstance(invocation.getInstance()); }
@Override public void intercept(IMethodInvocation invocation) throws Throwable { Properties original = new Properties(); original.putAll(System.getProperties()); try { invocation.proceed(); } finally { System.setProperties(original); } } }
@Override public void interceptSetupSpecMethod(IMethodInvocation invocation) throws Throwable { manager.beforeTestClass(); invocation.proceed(); }
@Override public void interceptCleanupSpecMethod(IMethodInvocation invocation) throws Throwable { try { invocation.proceed(); } finally { shutdownRegistry(); } }