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(); }
private void addCategoriesAsTags(Set<TestTag> tags) { Category annotation = description.getAnnotation(Category.class); if (annotation != null) { // @formatter:off stream(annotation.value()) .map(ReflectionUtils::getAllAssignmentCompatibleClasses) .flatMap(Collection::stream) .distinct() .map(Class::getName) .map(TestTag::create) .forEachOrdered(tags::add); // @formatter:on } }
public static Class<?>[] getCategoryAnnotations(Class<?> c) { Category category = c.getAnnotation(Category.class); if (category != null) { return category.value(); } return new Class<?>[0]; }
private static long getTimeoutInSeconds(Class<?> clazz) { Category[] categories = clazz.getAnnotationsByType(Category.class); for (Class<?> c : categories[0].value()) { if (c == SmallTests.class || c == MediumTests.class || c == LargeTests.class) { // All tests have a 10minute timeout. return TimeUnit.MINUTES.toSeconds(13); } if (c == IntegrationTests.class) { return TimeUnit.MINUTES.toSeconds(Long.MAX_VALUE); } } throw new IllegalArgumentException( clazz.getName() + " does not have SmallTests/MediumTests/LargeTests in @Category"); }
@Override public void testStarted(Description description) throws Exception { Category[] categories = description.getTestClass().getAnnotationsByType(Category.class); for (Class<?> c : categories[0].value()) { if (c == IntegrationTests.class) { return; } } for (Field field : description.getTestClass().getFields()) { if (Modifier.isStatic(field.getModifiers()) && field.getType() == HBaseClassTestRule.class && field.isAnnotationPresent(ClassRule.class)) { HBaseClassTestRule timeout = (HBaseClassTestRule) field.get(null); assertEquals( "The HBaseClassTestRule ClassRule in " + description.getTestClass().getName() + " is for " + timeout.getClazz().getName(), description.getTestClass(), timeout.getClazz()); return; } } fail("No HBaseClassTestRule ClassRule for " + description.getTestClass().getName()); } }
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 Function<Category, Iterable<String>> toCategoryNames() { return a -> { if (a == null) { return Collections.emptyList(); } return FCollection.map(Arrays.asList(a.value()),toName()); }; }
/** @return the name field attached to the marker. Null if no annotation, "" if no value field. */ public @Nullable Class<?>[] getMarkerValue() { if( categories == null) { return null; } return categories.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(); }
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 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(); }
private Function<Category, Iterable<String>> toCategoryNames() { return a -> { if (a == null) { return Collections.emptyList(); } return FCollection.map(Arrays.asList(a.value()),toName()); }; }
public static Class<?>[] getCategoryAnnotations(Class<?> c) { Category category = c.getAnnotation(Category.class); if (category != null) { return category.value(); } return new Class<?>[0]; }
public static Class<?>[] getCategoryAnnotations(Class<?> c) { Category category = c.getAnnotation(Category.class); if (category != null) { return category.value(); } return new Class<?>[0]; }
public static boolean isLongRunning(FrameworkMethod member){ boolean isLongRunning = false; Category categoriesAnn = member.getAnnotation(Category.class); if(categoriesAnn != null){ Class[] categories = categoriesAnn.value(); for(Class category: categories){ if(category.equals(LongRunning.class)){ isLongRunning = true; break; } } } return isLongRunning; }
@Before public void setup() { description.markHits( testMethodName ); String name = testMethodName.getMethodName(); if( null != annotated.getCats() ) { for( int i = 0; i < annotated.getCats().value().length; i++ ) { Class<?> top = annotated.getCats().value()[ i ]; assumeThat( "test: " + name + " not run because FS is/has not: " + top.getSimpleName(), description.provides( top ), is( true )); } } assumeThat( "known bug: " + name,description.isBug( testMethodName ), is( false ) ); }