FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(After.class).get(0);
testAndAssertErrorMessage(method, "@After can not be combined with @Category");
}
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));
}