本文整理汇总了Java中org.junit.experimental.theories.PotentialAssignment类的典型用法代码示例。如果您正苦于以下问题:Java PotentialAssignment类的具体用法?Java PotentialAssignment怎么用?Java PotentialAssignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PotentialAssignment类属于org.junit.experimental.theories包,在下文中一共展示了PotentialAssignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueSources
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature param) {
final ArrayList<PotentialAssignment> list = new ArrayList<>();
list.add(PotentialAssignment.forValue("", "foo"));
list.add(PotentialAssignment.forValue("", "bar"));
list.add(PotentialAssignment.forValue("", "foo"));
list.add(PotentialAssignment.forValue("", "bar"));
list.add(PotentialAssignment.forValue("", "foobar"));
list.add(PotentialAssignment.forValue("", "foobar"));
list.add(PotentialAssignment.forValue("", "foobar"));
list.add(PotentialAssignment.forValue("", "whut?"));
list.add(PotentialAssignment.forValue("", "OMGWTFBBQ"));
list.add(PotentialAssignment.forValue("", "muahhahahahahahahaha"));
list.add(PotentialAssignment.forValue("", "ijrobbeoubgt3t9hboebalnpajtih39"));
list.add(PotentialAssignment.forValue("", "ijrobbeoubgt3t9hboebalnpajtih39"));
return list;
}
示例2: addMultiPointMethods
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addMultiPointMethods(ParameterSignature sig, List<PotentialAssignment> list) throws Throwable {
for (FrameworkMethod dataPointsMethod : getDataPointsMethods(sig)) {
Class<?> returnType = dataPointsMethod.getReturnType();
if ((returnType.isArray() && sig.canPotentiallyAcceptType(returnType.getComponentType())) ||
Iterable.class.isAssignableFrom(returnType)) {
try {
addDataPointsValues(returnType, sig, dataPointsMethod.getName(), list,
dataPointsMethod.invokeExplosively(null));
} catch (Throwable throwable) {
DataPoints annotation = dataPointsMethod.getAnnotation(DataPoints.class);
if (annotation != null && isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)) {
return;
} else {
throw throwable;
}
}
}
}
}
示例3: addFields
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addFields(ParameterSignature sig,
List<PotentialAssignment> list) {
for (final Field field : fClass.getJavaClass().getFields()) {
if (Modifier.isStatic(field.getModifiers())) {
Class<?> type = field.getType();
if (sig.canAcceptArrayType(type)
&& field.getAnnotation(DataPoints.class) != null) {
try {
addArrayValues(field.getName(), list, getStaticFieldValue(field));
} catch (Throwable e) {
// ignore and move on
}
} else if (sig.canAcceptType(type)
&& field.getAnnotation(DataPoint.class) != null) {
list.add(PotentialAssignment
.forValue(field.getName(), getStaticFieldValue(field)));
}
}
}
}
示例4: runWithIncompleteAssignment
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
protected void runWithIncompleteAssignment(Assignments incomplete) throws Throwable{
for(PotentialAssignment source:incomplete.potentialsForNextUnassigned()){
final Assignments nextAssignment = incomplete.assignNext(source);
ForkJoinTask<?> run = new RecursiveAction(){
@Override
protected void compute(){
try{
ParallelTheoryAnchor.this.runWithAssignment(nextAssignment);
}catch(Throwable t){
throw new RuntimeException(t);
}
}
};
runs.addFirst(run.fork());
}
}
示例5: addFields
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addFields(final ParameterSignature sig, final List<PotentialAssignment> list) {
for (final Field field : fClass.getJavaClass().getFields()) {
if (Modifier.isStatic(field.getModifiers())) {
Class<?> type = field.getType();
if (sig.canAcceptArrayType(type) && field.getAnnotation(DataPoints.class) != null) {
try {
addArrayValues(field.getName(), list, getStaticFieldValue(field));
} catch (Throwable e) {
// ignore and move on
}
} else if (sig.canAcceptType(type) && field.getAnnotation(DataPoint.class) != null) {
list.add(PotentialAssignment.forValue(field.getName(), getStaticFieldValue(field)));
}
}
}
}
示例6: getValueSources
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) throws Throwable {
final List<PotentialAssignment> list = new ArrayList<PotentialAssignment>();
list.add(PotentialAssignment.forValue("long", 2L));
list.add(PotentialAssignment.forValue("float", 5.00f));
list.add(PotentialAssignment.forValue("double", 89d));
return list;
}
示例7: getValueSources
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
List<PotentialAssignment> list = new ArrayList<PotentialAssignment>();
TestedOn testedOn = sig.getAnnotation(TestedOn.class);
int[] ints = testedOn.ints();
for (final int i : ints) {
list.add(PotentialAssignment.forValue("ints", i));
}
return list;
}
示例8: getValueSources
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) throws Throwable {
List<PotentialAssignment> list = new ArrayList<PotentialAssignment>();
addSinglePointFields(sig, list);
addMultiPointFields(sig, list);
addSinglePointMethods(sig, list);
addMultiPointMethods(sig, list);
return list;
}
示例9: addSinglePointMethods
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addSinglePointMethods(ParameterSignature sig, List<PotentialAssignment> list) {
for (FrameworkMethod dataPointMethod : getSingleDataPointMethods(sig)) {
if (sig.canAcceptType(dataPointMethod.getType())) {
list.add(new MethodParameterValue(dataPointMethod));
}
}
}
示例10: addSinglePointFields
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addSinglePointFields(ParameterSignature sig, List<PotentialAssignment> list) {
for (final Field field : getSingleDataPointFields(sig)) {
Object value = getStaticFieldValue(field);
if (sig.canAcceptValue(value)) {
list.add(PotentialAssignment.forValue(field.getName(), value));
}
}
}
示例11: addDataPointsValues
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addDataPointsValues(Class<?> type, ParameterSignature sig, String name,
List<PotentialAssignment> list, Object value) {
if (type.isArray()) {
addArrayValues(sig, name, list, value);
}
else if (Iterable.class.isAssignableFrom(type)) {
addIterableValues(sig, name, list, (Iterable<?>) value);
}
}
示例12: addArrayValues
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addArrayValues(ParameterSignature sig, String name, List<PotentialAssignment> list, Object array) {
for (int i = 0; i < Array.getLength(array); i++) {
Object value = Array.get(array, i);
if (sig.canAcceptValue(value)) {
list.add(PotentialAssignment.forValue(name + "[" + i + "]", value));
}
}
}
示例13: addIterableValues
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private void addIterableValues(ParameterSignature sig, String name, List<PotentialAssignment> list, Iterable<?> iterable) {
Iterator<?> iterator = iterable.iterator();
int i = 0;
while (iterator.hasNext()) {
Object value = iterator.next();
if (sig.canAcceptValue(value)) {
list.add(PotentialAssignment.forValue(name + "[" + i + "]", value));
}
i += 1;
}
}
示例14: getValueSources
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
Object[] enumValues = enumType.getEnumConstants();
List<PotentialAssignment> assignments = new ArrayList<PotentialAssignment>();
for (Object value : enumValues) {
assignments.add(PotentialAssignment.forValue(value.toString(), value));
}
return assignments;
}
示例15: allUnassigned
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
/**
* Returns a new assignment list for {@code testMethod}, with no params
* assigned.
*/
public static Assignments allUnassigned(Method testMethod,
TestClass testClass) {
List<ParameterSignature> signatures;
signatures = ParameterSignature.signatures(testClass
.getOnlyConstructor());
signatures.addAll(ParameterSignature.signatures(testMethod));
return new Assignments(new ArrayList<PotentialAssignment>(),
signatures, testClass);
}