private boolean isIgnored(Description description) { return description.getAnnotation(Ignore.class) != null; }
private boolean isIgnored(Description description) { return description.getAnnotation(Ignore.class) != null; }
private static Class<?>[] directCategories(Description description) { if (description == null) { return new Class<?>[0]; } Category annotation= description.getAnnotation(Category.class); return annotation == null ? new Class<?>[0] : annotation.value(); }
private Class<?>[] directCategories(Description description) { if (description == null) { return new Class<?>[0]; } Category annotation = description.getAnnotation(Category.class); if (annotation == null) { return new Class<?>[0]; } return annotation.value(); } }
private static Class<?>[] directCategories(Description description) { if (description == null) { return new Class<?>[0]; } Category annotation= description.getAnnotation(Category.class); return annotation == null ? new Class<?>[0] : annotation.value(); }
@Override public Statement apply(final Statement base, final Description description) { final Repeat repeat = description.getAnnotation(Repeat.class); return repeat != null ? new RepeatStatement(base, repeat.count()) : base; } }
private void assertNoDescendantsHaveCategoryAnnotations(Description description) throws InitializationError { for (Description each : description.getChildren()) { if (each.getAnnotation(Category.class) != null) { throw new InitializationError("Category annotations on Parameterized classes are not supported on individual methods."); } assertNoDescendantsHaveCategoryAnnotations(each); } }
private void configureRunner(Runner runner) throws InvalidOrderingException { Description description = runner.getDescription(); OrderWith orderWith = description.getAnnotation(OrderWith.class); if (orderWith != null) { Ordering ordering = Ordering.definedBy(orderWith.value(), description); ordering.apply(runner); } }
private ZoneId[] zonesOf( Description description ) { TimeZone zone = description.getAnnotation( TimeZone.class ); String[] ids = zone == null ? null : zone.value(); if ( ids == null || ids.length == 0 ) { return new ZoneId[] {UTC}; } else { ZoneId[] zones = new ZoneId[ids.length]; for ( int i = 0; i < zones.length; i++ ) { zones[i] = ZoneId.of( ids[i] ); } return zones; } } };
@Override public Statement apply(Statement base, Description description) { if (description.getAnnotation(RunTestSetup.class) != null) { try { doTearDownClass(); } catch (Exception e) { throw new RuntimeException(e); } } return base; } };
protected void evaluatePerTest(final Statement base, final Description description) throws Throwable { if (isTest(description)) { Retry retry = description.getAnnotation(Retry.class); int retryCount = getRetryCount(retry); evaluate(base, description, retryCount); } }
protected void evaluate(final Statement statement, final Description description) throws Throwable { if (isTest(description)) { Repeat repeat = description.getAnnotation(Repeat.class); for (int count = 0, repetitions = getRepetitions(repeat); count < repetitions; count++) { statement.evaluate(); } } }
@Override public void testRunStarted(Description description) { if (description.isSuite() && description.getAnnotation(Ignore.class) == null) { fireExecutionStarted(testRun.getRunnerTestDescriptor()); } }
@Override public Statement apply(final Statement stmt, final Description description) { final SystemDefaults defaults = description.getAnnotation(SystemDefaults.class); if (defaults == null) { return stmt; } return applyTimeZone(defaults, applyLocale(defaults, stmt)); }
@Override public Statement apply( Statement statement, Description description ) { Statement result = statement; Repeat repeat = description.getAnnotation(Repeat.class); if( repeat != null ) { int times = repeat.times(); result = new RepeatStatement( times, statement ); } return result; } }
@Override public Statement apply(Statement statement, Description description) { Statement result = statement; RepeatRule.Repeat repeat = description.getAnnotation(RepeatRule.Repeat.class); if (repeat != null) { int times = repeat.times(); result = new RepeatRule.RepeatStatement(times, statement); } return result; }
protected <T extends Annotation> T hasAnnotation(Description description, Class<T> annotationClass) { T annotation = description.getAnnotation(annotationClass); if (annotation != null) { return annotation; } else if (description.isTest() && description.getTestClass().isAnnotationPresent(annotationClass)) { return description.getTestClass().getAnnotation(annotationClass); } return null; }
private Statement lifeStatement( Statement base, Description description ) { Life initialLifecycle = description.getAnnotation( Life.class ); if ( initialLifecycle != null ) { base = initialise( base, initialLifecycle.value() ); } return life.apply( base, description ); }
@Override public Statement apply( Statement base, Description description ) { Repeat repeat = description.getAnnotation( Repeat.class ); if ( repeat != null ) { return new RepeatStatement( repeat.times(), base, description ); } if ( defaultTimes > 1 ) { return new RepeatStatement( defaultTimes, base, description ); } return base; }
@Override public void evaluate() throws Throwable { MaxConnections maxConnections1 = description.getAnnotation(MaxConnections.class); ClientEventListener listener = new ClientEventListener(); final MockEventPublisher<ClientEventListener> publisher = MockEventPublisher.disabled(); int maxConnections = null == maxConnections1? DEFAULT_MAX_CONNECTIONS : maxConnections1.value(); init(maxConnections, publisher, publisher, listener); base.evaluate(); } };