本文整理匯總了Java中org.junit.experimental.categories.Category.value方法的典型用法代碼示例。如果您正苦於以下問題:Java Category.value方法的具體用法?Java Category.value怎麽用?Java Category.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.experimental.categories.Category
的用法示例。
在下文中一共展示了Category.value方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: withTimeout
import org.junit.experimental.categories.Category; //導入方法依賴的package包/類
public Timeout.Builder withTimeout(Class<?> clazz) {
Annotation annotation = clazz.getAnnotation(Category.class);
if (annotation != null) {
Category category = (Category)annotation;
for (Class<?> c: category.value()) {
if (c == SmallTests.class) {
// See SmallTests. Supposed to run 15 seconds.
return withTimeout(30, TimeUnit.SECONDS);
} else if (c == MediumTests.class) {
// See MediumTests. Supposed to run 50 seconds.
return withTimeout(180, TimeUnit.SECONDS);
} else if (c == LargeTests.class) {
// Let large tests have a ten minute timeout.
return withTimeout(10, TimeUnit.MINUTES);
}
}
}
return this;
}
示例2: getCategoryAnnotations
import org.junit.experimental.categories.Category; //導入方法依賴的package包/類
public static Class<?>[] getCategoryAnnotations(Class<?> c) {
Category category = c.getAnnotation(Category.class);
if (category != null) {
return category.value();
}
return new Class<?>[0];
}