• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParameterSignature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.junit.experimental.theories.ParameterSignature的典型用法代码示例。如果您正苦于以下问题:Java ParameterSignature类的具体用法?Java ParameterSignature怎么用?Java ParameterSignature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParameterSignature类属于org.junit.experimental.theories包,在下文中一共展示了ParameterSignature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: shouldFindPossibleAssignmentsFromMethod

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Test
public void shouldFindPossibleAssignmentsFromMethod() throws Throwable {
    this.assignments = new PotentialAssignments(new TestClass(AssignmentsFromMethod.class));
    final List<Assignment> assignments = this.assignments.allPossible().collect(Collectors.toList());

    assertThat(assignments).hasSize(2);

    ArrayList<ParameterSignature> parameterSignature =
            ParameterSignature.signatures(AssignmentsFromMethod.class.getMethod("a", String.class));

    assertThat(assignments.get(0).isValidFor(parameterSignature.get(0)));
    assertThat(assignments.get(0).parameterProducer().produceParamValue()).isEqualTo("42");

    assertThat(assignments.get(1).isValidFor(parameterSignature.get(0)));
    assertThat(assignments.get(1).parameterProducer().produceParamValue()).isEqualTo("27");
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:17,代码来源:PotentialAssignmentsTest.java


示例2: getValueSources

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例3: addMultiPointMethods

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例4: getSingleDataPointFields

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Override
protected Collection<Field> getSingleDataPointFields(ParameterSignature sig) {
    Collection<Field> fields = super.getSingleDataPointFields(sig);        
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();

    List<Field> fieldsWithMatchingNames = new ArrayList<Field>();
    
    for (Field field : fields) {
        String[] fieldNames = field.getAnnotation(DataPoint.class).value();
        if (Arrays.asList(fieldNames).contains(requestedName)) {
            fieldsWithMatchingNames.add(field);
        }
    }
    
    return fieldsWithMatchingNames;
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:SpecificDataPointsSupplier.java


示例5: getDataPointsFields

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Override
protected Collection<Field> getDataPointsFields(ParameterSignature sig) {
    Collection<Field> fields = super.getDataPointsFields(sig);        
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();
    
    List<Field> fieldsWithMatchingNames = new ArrayList<Field>();
    
    for (Field field : fields) {
        String[] fieldNames = field.getAnnotation(DataPoints.class).value();
        if (Arrays.asList(fieldNames).contains(requestedName)) {
            fieldsWithMatchingNames.add(field);
        }
    }
    
    return fieldsWithMatchingNames;
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:SpecificDataPointsSupplier.java


示例6: getSingleDataPointMethods

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Override
protected Collection<FrameworkMethod> getSingleDataPointMethods(ParameterSignature sig) {
    Collection<FrameworkMethod> methods = super.getSingleDataPointMethods(sig);
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();
    
    List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>();
    
    for (FrameworkMethod method : methods) {
        String[] methodNames = method.getAnnotation(DataPoint.class).value();
        if (Arrays.asList(methodNames).contains(requestedName)) {
            methodsWithMatchingNames.add(method);
        }
    }
    
    return methodsWithMatchingNames;
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:SpecificDataPointsSupplier.java


示例7: getDataPointsMethods

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Override
protected Collection<FrameworkMethod> getDataPointsMethods(ParameterSignature sig) {
    Collection<FrameworkMethod> methods = super.getDataPointsMethods(sig);
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();
    
    List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>();
    
    for (FrameworkMethod method : methods) {
        String[] methodNames = method.getAnnotation(DataPoints.class).value();
        if (Arrays.asList(methodNames).contains(requestedName)) {
            methodsWithMatchingNames.add(method);
        }
    }
    
    return methodsWithMatchingNames;
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:SpecificDataPointsSupplier.java


示例8: addFields

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例9: addFields

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例10: isValidFor

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Override
public boolean isValidFor(ParameterSignature parameterSignature) {
    if (!isProducerNameValid(parameterSignature.getAnnotation(ProducedValue.class))) {
        return false;
    }
    Class<?> type = field.getField().getType();
    Class<?> aClass = primitiveSupplierToType.get(type);
    if (aClass != null && aClass.equals(parameterSignature.getType())) {
        return true;
    } else {
        Type genericType = field.getField().getGenericType();
        return isValidGenericType(parameterSignature, genericType);
    }
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:15,代码来源:FieldAssignment.java


示例11: potentialNextParameterProducers

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
List<ParameterProducer> potentialNextParameterProducers() throws Throwable {
    ParameterSignature next = nextUnassigned();
    return new PotentialAssignments(testClass).allPossible()
            .filter(assignment -> assignment.isValidFor(next))
            .map(Assignment::parameterProducer)
            .collect(Collectors.toList());
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:8,代码来源:ProducerAssignments.java


示例12: isValidGenericType

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
boolean isValidGenericType(ParameterSignature parameterSignature, Type genericType) {
    if (genericType instanceof ParameterizedType) {
        ParameterizedType parametrizedType = (ParameterizedType) genericType;
        Type[] actualTypeArguments = parametrizedType.getActualTypeArguments();
        Type actualTypeArgument = actualTypeArguments[0];
        if (parameterSignature.getType().equals(actualTypeArgument)
                || parameterSignature.getType().equals(primitiveSupplierToType.get(actualTypeArgument))) {
            return true;
        }
    }
    return false;
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:13,代码来源:BasicAssignment.java


示例13: shouldHaveAssignmentsFromField

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Test
public void shouldHaveAssignmentsFromField() throws Throwable {
    this.assignments = new PotentialAssignments(new TestClass(AssignmentsFromField.class));
    List<Assignment> assignments = this.assignments.allPossible().collect(Collectors.toList());
    assertThat(assignments).hasSize(1);

    ArrayList<ParameterSignature> parameterSignature =
            ParameterSignature.signatures(AssignmentsFromField.class.getMethod("a", String.class));

    Assignment assignment = assignments.get(0);
    assertThat(assignment.isValidFor(parameterSignature.get(0))).isTrue();
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:13,代码来源:PotentialAssignmentsTest.java


示例14: shouldNotBeValidIfTypeDoesNotMatch

import org.junit.experimental.theories.ParameterSignature; //导入依赖的package包/类
@Test
public void shouldNotBeValidIfTypeDoesNotMatch() throws Throwable {
    this.assignments = new PotentialAssignments(new TestClass(AssignmentsFromField.class));
    List<Assignment> assignments = this.assignments.allPossible().collect(Collectors.toList());;

    ArrayList<ParameterSignature> parameterSignature =
            ParameterSignature.signatures(AssignmentsFromField.class.getMethod("b", Integer.TYPE));
    Assignment assignment = assignments.get(0);
    assertThat(assignment.isValidFor(parameterSignature.get(0))).isFalse();
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:11,代码来源:PotentialAssignmentsTest.java


示例15: getValueSources

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例16: getValueSources

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例17: getValueSources

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例18: addSinglePointMethods

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例19: addSinglePointFields

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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


示例20: addDataPointsValues

import org.junit.experimental.theories.ParameterSignature; //导入依赖的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



注:本文中的org.junit.experimental.theories.ParameterSignature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GroupChannel类代码示例发布时间:2022-05-22
下一篇:
Java AttributeCertificate类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap