本文整理汇总了Java中org.junit.experimental.theories.ParameterSupplier类的典型用法代码示例。如果您正苦于以下问题:Java ParameterSupplier类的具体用法?Java ParameterSupplier怎么用?Java ParameterSupplier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterSupplier类属于org.junit.experimental.theories包,在下文中一共展示了ParameterSupplier类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSupplier
import org.junit.experimental.theories.ParameterSupplier; //导入依赖的package包/类
private ParameterSupplier getSupplier(ParameterSignature unassigned)
throws Exception {
ParametersSuppliedBy annotation = unassigned
.findDeepAnnotation(ParametersSuppliedBy.class);
if (annotation != null) {
return buildParameterSupplierFromClass(annotation.value());
} else {
return new AllMembersSupplier(fClass);
}
}
示例2: buildParameterSupplierFromClass
import org.junit.experimental.theories.ParameterSupplier; //导入依赖的package包/类
private ParameterSupplier buildParameterSupplierFromClass(
Class<? extends ParameterSupplier> cls) throws Exception {
Constructor<?>[] supplierConstructors = cls.getConstructors();
for (Constructor<?> constructor : supplierConstructors) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
if (parameterTypes.length == 1
&& parameterTypes[0].equals(TestClass.class)) {
return (ParameterSupplier) constructor.newInstance(fClass);
}
}
return cls.newInstance();
}
示例3: getSupplier
import org.junit.experimental.theories.ParameterSupplier; //导入依赖的package包/类
public ParameterSupplier getSupplier(ParameterSignature unassigned)
throws InstantiationException, IllegalAccessException {
ParameterSupplier supplier = getAnnotatedSupplier(unassigned);
if (supplier != null) {
return supplier;
}
return new AllMembersSupplier(fClass);
}
示例4: getAnnotatedSupplier
import org.junit.experimental.theories.ParameterSupplier; //导入依赖的package包/类
public ParameterSupplier getAnnotatedSupplier(ParameterSignature unassigned)
throws InstantiationException, IllegalAccessException {
ParametersSuppliedBy annotation = unassigned
.findDeepAnnotation(ParametersSuppliedBy.class);
if (annotation == null) {
return null;
}
return annotation.value().newInstance();
}