本文整理汇总了Java中org.junit.experimental.theories.PotentialAssignment类的典型用法代码示例。如果您正苦于以下问题:Java PotentialAssignment类的具体用法?Java PotentialAssignment怎么用?Java PotentialAssignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PotentialAssignment类属于org.junit.experimental.theories包,在下文中一共展示了PotentialAssignment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:RWTH-i5-IDSG,项目名称:jamocha,代码行数:18,代码来源:TestData.java
示例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;
}
}
}
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:21,代码来源:AllMembersSupplier.java
示例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)));
}
}
}
}
开发者ID:lcm-proj,项目名称:lcm,代码行数:21,代码来源:AllMembersSupplier.java
示例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());
}
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:18,代码来源:ParallelTheoryRunner.java
示例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)));
}
}
}
}
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:AllMembersSupplier.java
示例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;
}
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:12,代码来源:NumberSupplier.java
示例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;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:11,代码来源:TestedOnSupplier.java
示例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;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:AllMembersSupplier.java
示例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));
}
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:8,代码来源:AllMembersSupplier.java
示例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));
}
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:AllMembersSupplier.java
示例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);
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:AllMembersSupplier.java
示例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));
}
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:9,代码来源:AllMembersSupplier.java
示例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;
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:AllMembersSupplier.java
示例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;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:EnumSupplier.java
示例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);
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:14,代码来源:Assignments.java
示例16: assignNext
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
public Assignments assignNext(PotentialAssignment source) {
List<PotentialAssignment> assigned = new ArrayList<PotentialAssignment>(
fAssigned);
assigned.add(source);
return new Assignments(assigned, fUnassigned.subList(1,
fUnassigned.size()), fClass);
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:9,代码来源:Assignments.java
示例17: potentialsForNextUnassigned
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
public List<PotentialAssignment> potentialsForNextUnassigned()
throws Throwable {
ParameterSignature unassigned = nextUnassigned();
List<PotentialAssignment> assignments = getSupplier(unassigned).getValueSources(unassigned);
if (assignments.size() == 0) {
assignments = generateAssignmentsFromTypeAlone(unassigned);
}
return assignments;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:Assignments.java
示例18: generateAssignmentsFromTypeAlone
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
private List<PotentialAssignment> generateAssignmentsFromTypeAlone(ParameterSignature unassigned) {
Class<?> paramType = unassigned.getType();
if (paramType.isEnum()) {
return new EnumSupplier(paramType).getValueSources(unassigned);
} else if (paramType.equals(Boolean.class) || paramType.equals(boolean.class)) {
return new BooleanSupplier().getValueSources(unassigned);
} else {
return emptyList();
}
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:Assignments.java
示例19: shouldUseQuotedValueInDescription
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Test
public void shouldUseQuotedValueInDescription() throws CouldNotGenerateValueException {
String name = "stringDatapoint";
Object value = new Object() {
@Override
public String toString() {
return "string value";
}
};
PotentialAssignment assignment = PotentialAssignment.forValue(name, value);
assertEquals("\"string value\" <from stringDatapoint>", assignment.getDescription());
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:15,代码来源:PotentialAssignmentTest.java
示例20: shouldNotUseQuotesForNullValueDescriptions
import org.junit.experimental.theories.PotentialAssignment; //导入依赖的package包/类
@Test
public void shouldNotUseQuotesForNullValueDescriptions() throws CouldNotGenerateValueException {
String name = "nullDatapoint";
Object value = null;
PotentialAssignment assignment = PotentialAssignment.forValue(name, value);
assertEquals("null <from nullDatapoint>", assignment.getDescription());
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:PotentialAssignmentTest.java
注:本文中的org.junit.experimental.theories.PotentialAssignment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论