@Override public Statement methodBlock(final FrameworkMethod method) { return new TheoryAnchor(method, getTestClass()); }
public <T extends Annotation> T findDeepAnnotation(Class<T> annotationType) { Annotation[] annotations2 = annotations; return findDeepAnnotation(annotations2, annotationType, 3); }
@Override protected void validateConstructor(List<Throwable> errors) { validateOnlyOneConstructor(errors); }
@Override protected void validateTestMethods(List<Throwable> errors) { for (FrameworkMethod each : computeTestMethods()) { if (each.getAnnotation(Theory.class) != null) { each.validatePublicVoid(false, errors); each.validateNoTypeParametersOnArgs(errors); } else { each.validatePublicVoidNoArg(false, errors); } for (ParameterSignature signature : ParameterSignature.signatures(each.getMethod())) { ParametersSuppliedBy annotation = signature.findDeepAnnotation(ParametersSuppliedBy.class); if (annotation != null) { validateParameterSupplier(annotation.value(), errors); } } } }
private ParameterSupplier getSupplier(ParameterSignature unassigned) throws Exception { ParametersSuppliedBy annotation = unassigned .findDeepAnnotation(ParametersSuppliedBy.class); if (annotation != null) { return buildParameterSupplierFromClass(annotation.value()); } else { return new AllMembersSupplier(clazz); } }
protected void runWithIncompleteAssignment(Assignments incomplete) throws Throwable { for (PotentialAssignment source : incomplete .potentialsForNextUnassigned()) { runWithAssignment(incomplete.assignNext(source)); } }
public Object[] getActualValues(int start, int stop, boolean nullsOk) throws CouldNotGenerateValueException { Object[] values = new Object[stop - start]; for (int i = start; i < stop; i++) { Object value = fAssigned.get(i).getValue(); if (value == null && !nullsOk) { throw new CouldNotGenerateValueException(); } values[i - start] = value; } return values; }
public ParameterSupplier getAnnotatedSupplier(ParameterSignature unassigned) throws InstantiationException, IllegalAccessException { ParametersSuppliedBy annotation = unassigned .findDeepAnnotation(ParametersSuppliedBy.class); if (annotation == null) { return null; } return annotation.value().newInstance(); }
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)); } } }
public boolean canPotentiallyAcceptType(Class<?> candidate) { return candidate.isAssignableFrom(type) || isAssignableViaTypeConversion(candidate, type) || canAcceptType(candidate); }
@Override protected void collectInitializationErrors(List<Throwable> errors) { super.collectInitializationErrors(errors); validateDataPointFields(errors); validateDataPointMethods(errors); }
public boolean hasAnnotation(Class<? extends Annotation> type) { return getAnnotation(type) != null; }
public Object[] getActualValues(int start, int stop) throws CouldNotGenerateValueException { Object[] values = new Object[stop - start]; for (int i = start; i < stop; i++) { values[i - start] = assigned.get(i).getValue(); } return values; }
public Object[] getArgumentStrings(boolean nullsOk) throws CouldNotGenerateValueException { Object[] values = new Object[assigned.size()]; for (int i = 0; i < values.length; i++) { values[i] = assigned.get(i).getDescription(); } return values; } }
@SuppressWarnings("deprecation") private boolean isCorrectlyTyped(ParameterSignature parameterSignature, Class<?> type) { return parameterSignature.canAcceptType(type); }
@Override public Statement methodBlock(final FrameworkMethod method) { return new TheoryAnchor(method, getTestClass()); }
public boolean hasAnnotation(Class<? extends Annotation> type) { return getAnnotation(type) != null; }
public <T extends Annotation> T findDeepAnnotation(Class<T> annotationType) { Annotation[] annotations2 = annotations; return findDeepAnnotation(annotations2, annotationType, 3); }
@Override protected void validateConstructor(List<Throwable> errors) { validateOnlyOneConstructor(errors); }