Search in sources :

Example 1 with CategoryValidator

use of org.junit.experimental.categories.CategoryValidator in project junit4 by junit-team.

the class CategoryValidatorTest method testAndAssertErrorMessage.

private void testAndAssertErrorMessage(FrameworkMethod method, String expectedErrorMessage) {
    List<Exception> errors = new CategoryValidator().validateAnnotatedMethod(method);
    assertThat(errors.size(), is(1));
    Exception exception = errors.get(0);
    assertThat(exception.getMessage(), is(expectedErrorMessage));
}
Also used : CategoryValidator(org.junit.experimental.categories.CategoryValidator)

Example 2 with CategoryValidator

use of org.junit.experimental.categories.CategoryValidator 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));
}
Also used : CategoryValidator(org.junit.experimental.categories.CategoryValidator) FrameworkMethod(org.junit.runners.model.FrameworkMethod) Test(org.junit.Test)

Aggregations

CategoryValidator (org.junit.experimental.categories.CategoryValidator)2 Test (org.junit.Test)1 FrameworkMethod (org.junit.runners.model.FrameworkMethod)1