use of org.junit.runners.model.FrameworkMethod in project junit4 by junit-team.
the class CategoryValidatorTest method errorIsNotAddedWhenCategoryIsNotCombinedWithIllegalCombination.
@Test
public void errorIsNotAddedWhenCategoryIsNotCombinedWithIllegalCombination() throws NoSuchMethodException {
FrameworkMethod method = new FrameworkMethod(CategoryTest.class.getMethod("methodWithCategory"));
List<Exception> errors = new CategoryValidator().validateAnnotatedMethod(method);
assertThat(errors.size(), is(0));
}
use of org.junit.runners.model.FrameworkMethod in project junit4 by junit-team.
the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithAfterClass.
@Test
public void errorIsAddedWhenCategoryIsUsedWithAfterClass() {
FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(AfterClass.class).get(0);
testAndAssertErrorMessage(method, "@AfterClass can not be combined with @Category");
}
use of org.junit.runners.model.FrameworkMethod in project junit4 by junit-team.
the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithAfter.
@Test
public void errorIsAddedWhenCategoryIsUsedWithAfter() {
FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(After.class).get(0);
testAndAssertErrorMessage(method, "@After can not be combined with @Category");
}
use of org.junit.runners.model.FrameworkMethod in project junit4 by junit-team.
the class SpecificDataPointsSupplier method getSingleDataPointMethods.
@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;
}
use of org.junit.runners.model.FrameworkMethod in project junit4 by junit-team.
the class SpecificDataPointsSupplier method getDataPointsMethods.
@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;
}
Aggregations