@Override public void evaluate() throws Throwable { try { methodBlock.evaluate(); } finally { registryConfigurator.restoreRegistry(); } } };
@Override public void evaluate() throws Throwable { WrappingInjectorProvider wrapped = getOrCreateInjectorProvider(); wrapped.setupRegistry(); try { prepareChildren(notifier); } finally { wrapped.restoreRegistry(); } IInjectorProvider delegate = wrapped.getDelegate(); if (delegate instanceof IRegistryConfigurator) { IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) delegate; registryConfigurator.setupRegistry(); try { runChildren(notifier); } finally { registryConfigurator.restoreRegistry(); } } else { runChildren(notifier); } } };
@Override protected Statement methodBlock(final FrameworkMethod method) { IInjectorProvider injectorProvider = getOrCreateInjectorProvider(); final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider; registryConfigurator.setupRegistry(); final Statement methodBlock = superMethodBlock(method); return new Statement() { @Override public void evaluate() throws Throwable { try { try { methodBlock.evaluate(); throw new AssumptionViolatedException("Method " + method.getName() + " did parse any input"); } finally { registryConfigurator.restoreRegistry(); } } catch(TestDataCarrier testData) { process(testData.getData()); } } }; }
protected void process(String data) throws Exception { IInjectorProvider delegate = getOrCreateInjectorProvider().getDelegate(); if (delegate instanceof IRegistryConfigurator) { IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) delegate; registryConfigurator.setupRegistry(); try { ScenarioProcessor processor = delegate.getInjector().getInstance(processorClass); String preProcessed = processor.preProcess(data); if (preProcessed == null) { throw new AssumptionViolatedException("Input is filtered by the pre processing step: " + data); } doProcess(preProcessed, processor); } finally { registryConfigurator.restoreRegistry(); } } }
@Override protected Statement methodBlock(FrameworkMethod method) { IInjectorProvider injectorProvider = getOrCreateInjectorProvider(); if (injectorProvider instanceof IRegistryConfigurator) { final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider; registryConfigurator.setupRegistry(); final Statement methodBlock = superMethodBlock(method); return new Statement() { @Override public void evaluate() throws Throwable { try { methodBlock.evaluate(); } finally { registryConfigurator.restoreRegistry(); } } }; }else{ return superMethodBlock(method); } }
protected void runChild(ParameterSetRunner ps) throws Throwable { MethodWithExpectation method = findTestMethod(ps.getMethdoName()); Object test = newTestInstance(); if (ps.getInjectorProvider() instanceof IRegistryConfigurator) ((IRegistryConfigurator) ps.getInjectorProvider()).setupRegistry(); try { injectParameters(test, ps.getParams()); ps.getInjectorProvider().getInjector().injectMembers(test); Object result = method.getMethod().invoke(test); method.getValidator().validate(ps.getResource(), ps.getExpectation(), result); } catch (InvocationTargetException e) { throw e.getCause(); } finally { if (ps.getInjectorProvider() instanceof IRegistryConfigurator) ((IRegistryConfigurator) ps.getInjectorProvider()).restoreRegistry(); } }
@Override public void evaluate() throws Throwable { try { methodBlock.evaluate(); } finally { registryConfigurator.restoreRegistry(); } } };
@Override protected Statement methodBlock(FrameworkMethod method) { IInjectorProvider injectorProvider = getOrCreateInjectorProvider(); if (injectorProvider instanceof IRegistryConfigurator) { final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider; registryConfigurator.setupRegistry(); final Statement methodBlock = super.methodBlock(method); return new Statement() { @Override public void evaluate() throws Throwable { try { methodBlock.evaluate(); } finally { registryConfigurator.restoreRegistry(); } } }; }else{ return super.methodBlock(method); } }
@Override public void evaluate() throws Throwable { try { try { methodBlock.evaluate(); throw new AssumptionViolatedException("Method " + method.getName() + " did parse any input"); } finally { registryConfigurator.restoreRegistry(); } } catch(TestDataCarrier testData) { process(testData.getData()); } } };