/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
@Override public void evaluate() throws Throwable { LOG.info("RUNNING TEST METHOD {}", name); try { super.evaluate(); Runtime rt = Runtime.getRuntime(); long usedKB = (rt.totalMemory() - rt.freeMemory()) / 1024; LOG.info("Memory used {}", usedKB); ThreadGroup tg = Thread.currentThread().getThreadGroup(); while (tg.getParent() != null) { tg = tg.getParent(); } LOG.info("Number of threads {}", tg.activeCount()); } catch (Throwable t) { // The test method threw an exception, but it might be an // expected exception as defined in the @Test annotation. // Check the annotation and log an appropriate message. Test annotation = this.method.getAnnotation(Test.class); if (annotation != null && annotation.expected() != null && annotation.expected().isAssignableFrom(t.getClass())) { LOG.info("TEST METHOD {} THREW EXPECTED EXCEPTION {}", name, annotation.expected()); } else { LOG.info("TEST METHOD FAILED {}", name, t); } throw t; } LOG.info("FINISHED TEST METHOD {}", name); } }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
@Override public void evaluate() throws Throwable { if (AbstractJUnit4CitrusTest.class.isAssignableFrom(testInstance.getClass()) && frameworkMethod instanceof CitrusFrameworkMethod) { ((AbstractJUnit4CitrusTest)testInstance).run((CitrusFrameworkMethod) frameworkMethod); } else { super.evaluate(); } } }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
/** * Returns a {@link org.junit.runners.model.Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
protected Statement buildStatement(final TestClass testClass, final FrameworkMethod method, final Object target, final Description description, final RunNotifier notifier) { return new InvokeMethod(method, target); } }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
/** * Returns a {@link Statement} that invokes {@code method} on {@code test} */ protected Statement methodInvoker(FrameworkMethod method, Object test) { return new InvokeMethod(method, test); }
@Override protected Statement methodInvoker(FrameworkMethod method, Object test) { ComplianceSuiteTest eTest = (ComplianceSuiteTest) test; eTest.setExecutor(executor); return new InvokeMethod(method, test); }
@Override protected Statement methodInvoker(final FrameworkMethod method, final Object test) { Statement s = new InvokeMethod(method, test); s = withLifecycleBefore(method, test, s); s = withLifecycleAfter(method, test, s); s = withLifecycleRules(method, test, s); return s; } }
@Override protected Statement methodInvoker(final FrameworkMethod method, final Object test) { Statement s = new InvokeMethod(method, test); s = withLifecycleBefore(method, test, s); s = withLifecycleAfter(method, test, s); s = withLifecycleRules(method, test, s); return s; } }
public static void runRule(TestRule rule, Object target, String methodName) { Class<?> clazz = target.getClass(); Method method = TestUtils.getMethod(clazz, methodName); Description description = Description.createTestDescription(clazz, method.getName(), method.getDeclaredAnnotations()); try { InvokeMethod invokeMethod = new InvokeMethod(new FrameworkMethod(method), target); rule.apply(invokeMethod, description).evaluate(); } catch (Throwable throwable) { logger.warning(Arrays.toString(throwable.getStackTrace())); } } }