Java 类org.junit.experimental.theories.DataPoint 实例源码

项目:sosiefier    文件:SpecificDataPointsSupplier.java   
@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;
}
项目:sosiefier    文件:SpecificDataPointsSupplier.java   
@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;
}
项目:lcm    文件:AllMembersSupplier.java   
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)));
            }
        }
    }
}
项目:junit    文件:AllMembersSupplier.java   
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)));
            }
        }
    }
}
项目:org.openntf.domino    文件:AllMembersSupplier.java   
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)));
            }
        }
    }
}
项目:Akatsuki    文件:InternalClassDiscoveryIntegrationTest.java   
@DataPoint
public static APITestScenario createSimpleSource() {
    TestSource source = new TestSource("test", generateClassName(), Modifier.PUBLIC);
    source.appendFields(new RetainedTestField(String.class).createFieldSpec(),
            new ArgTestField(Integer.class).createFieldSpec())
            .appendTransformation((b, s) -> b.superclass(MockedFragment.class));

    return base -> new APITestBase(base, source);
}
项目:Akatsuki    文件:InternalClassDiscoveryIntegrationTest.java   
@DataPoint
public static APITestScenario createSourceWithInnerClass() {
    TestSource enclosingClass = new TestSource("test", generateClassName(), Modifier.PUBLIC);
    TestSource source = new TestSource(null, generateClassName(), Modifier.PUBLIC);
    source.appendFields(new RetainedTestField(String.class).createFieldSpec(),
            new ArgTestField(Integer.class).createFieldSpec())
            .appendTransformation((b, s) -> b.superclass(MockedFragment.class));
    enclosingClass.innerClasses(true, source);
    return base -> new APITestBase(base, source, enclosingClass, new TestSource[] {});
}
项目:sosiefier    文件:AllMembersSupplier.java   
protected Collection<Field> getSingleDataPointFields(ParameterSignature sig) {
    List<FrameworkField> fields = fClass.getAnnotatedFields(DataPoint.class);
    Collection<Field> validFields = new ArrayList<Field>();

    for (FrameworkField frameworkField : fields) {
        validFields.add(frameworkField.getField());
    }

    return validFields;
}
项目:lcm    文件:AllMembersSupplier.java   
private void addSinglePointMethods(ParameterSignature sig,
        List<PotentialAssignment> list) {
    for (FrameworkMethod dataPointMethod : fClass
            .getAnnotatedMethods(DataPoint.class)) {
        if (isCorrectlyTyped(sig, dataPointMethod.getType())) {
            list.add(new MethodParameterValue(dataPointMethod));
        }
    }
}
项目:gocd    文件:MagicalMaterialAndMaterialConfigConversionTest.java   
private List<Class> allMaterialConfigsWhichAreDataPointsInThisTest() throws Exception {
    Set<Field> fields = Reflections.getAllFields(getClass(), Reflections.withAnnotation(DataPoint.class));

    ArrayList<Class> allDataPointMaterialConfigClasses = new ArrayList<>();
    for (Field field : fields) {
        allDataPointMaterialConfigClasses.add(field.get(this).getClass());
    }
    return allDataPointMaterialConfigClasses;
}
项目:junit    文件:AllMembersSupplier.java   
private void addSinglePointMethods(ParameterSignature sig,
        List<PotentialAssignment> list) {
    for (FrameworkMethod dataPointMethod : fClass
            .getAnnotatedMethods(DataPoint.class)) {
        if (isCorrectlyTyped(sig, dataPointMethod.getType())) {
            list.add(new MethodParameterValue(dataPointMethod));
        }
    }
}
项目:org.openntf.domino    文件:AllMembersSupplier.java   
private void addSinglePointMethods(final ParameterSignature sig, final List<PotentialAssignment> list) {
    for (FrameworkMethod dataPointMethod : fClass.getAnnotatedMethods(DataPoint.class)) {
        if (isCorrectlyTyped(sig, dataPointMethod.getType())) {
            list.add(new MethodParameterValue(dataPointMethod));
        }
    }
}
项目:Akatsuki    文件:AkatsukiProcessorSourceNameTest.java   
@DataPoint
public static GeneratedClassWithName simpleClass() {
    final JavaFileObject object = CodeGenUtils
            .createTestClass(field(STRING_TYPE, "foo", Retained.class));
    return new GeneratedClassWithName(object, TEST_CLASS);
}
项目:sosiefier    文件:AllMembersSupplier.java   
protected Collection<FrameworkMethod> getSingleDataPointMethods(ParameterSignature sig) {
    return fClass.getAnnotatedMethods(DataPoint.class);
}
项目:sosiefier    文件:SpecificDataPointsSupplierTest.java   
@DataPoint({"singlemethod", "named"})
public static String getSingleValue() { 
    return "named single method value";
}
项目:sosiefier    文件:SpecificDataPointsSupplierTest.java   
@DataPoint
public static String getSingleOtherValue() {
    return "other single method value";
}
项目:sosiefier    文件:AllMembersSupplierTest.java   
@DataPoint
public static Integer object() {
    return 1;
}
项目:sosiefier    文件:ParameterSignatureTest.java   
@DataPoint
public static Method getType() throws SecurityException,
        NoSuchMethodException {
    return ParameterSignatureTest.class.getMethod("getType", Method.class,
            int.class);
}
项目:sosiefier    文件:WithNamedDataPoints.java   
@DataPoint("named")
public static String methodString() {
    return "expected single method string";
}
项目:sosiefier    文件:WithNamedDataPoints.java   
@DataPoint
public static String otherSingleValueMethod() {
    return "other single value string";
}
项目:sosiefier    文件:FailingDataPointMethods.java   
@DataPoint
public static int failingDataPoint() {
    throw new RuntimeException();
}
项目:sosiefier    文件:FailingDataPointMethods.java   
@DataPoint(ignoredExceptions=Throwable.class)
public static int failingDataPoint() {
    throw new RuntimeException();
}
项目:sosiefier    文件:FailingDataPointMethods.java   
@DataPoint(ignoredExceptions=NullPointerException.class)
public static int failingDataPoint() {
    throw new RuntimeException();
}
项目:sosiefier    文件:FailingDataPointMethods.java   
@DataPoint(ignoredExceptions=NullPointerException.class)
public static int failingDataPoint() {
    throw new RuntimeException();
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@DataPoint
public int singleDataPointMethod() {
    return 1;
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@DataPoint
static int three() {
    return 3;
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@DataPoint
protected static int four() {
    return 4;
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@DataPoint
private static int five() {
    return 5;
}
项目:sosiefier    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}
项目:sosiefier    文件:WithDataPointMethod.java   
@DataPoint
public static List<Object> empty() {
    return new ArrayList<Object>();
}
项目:sosiefier    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}
项目:junit    文件:ParameterSignatureTest.java   
@DataPoint
public static Method getType() throws SecurityException,
        NoSuchMethodException {
    return ParameterSignatureTest.class.getMethod("getType", Method.class,
            int.class);
}
项目:junit    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}
项目:junit    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}
项目:junit    文件:WithDataPointMethod.java   
@DataPoint
public static int oneUglyHundred() {
    throw new RuntimeException();
}
项目:junit    文件:WithDataPointMethod.java   
@DataPoint
public static List<Object> empty() {
    return new ArrayList<Object>();
}
项目:junit    文件:WithDataPointMethod.java   
@DataPoint
public int oneHundred() {
    return 100;
}
项目:health-and-care-developer-network    文件:ParameterSignatureTest.java   
@DataPoint
public static Method getType() throws SecurityException,
        NoSuchMethodException {
    return ParameterSignatureTest.class.getMethod("getType", Method.class,
            int.class);
}
项目:health-and-care-developer-network    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}
项目:health-and-care-developer-network    文件:WithDataPointMethod.java   
@DataPoint
public static int oneHundred() {
    return 100;
}