SetPropertyMethod extends AbstractPropertyMethod { @Override public <T extends Annotation, M extends Annotation> T getByMetaAnnotation(Class<M> type) { if (super.getByMetaAnnotation(type) != null) { return reportInvalidAnnotationLocation(); } return getter.getByMetaAnnotation(type); } SetPropertyMethod(Method setter, GetPropertyMethod getter, String name, Class<?> type, Type genericType); @Override T getAnnotation(Class<T> type); @Override T getByMetaAnnotation(Class<M> type); @Override Annotation[] getAnnotations();  }
@Test public void getByMetaAnnotation() { TestAnnotation annotation = setPropertyMethod.getByMetaAnnotation(TestMetaAnnotation.class); assertThat(annotation, notNullValue()); }
@Test public void getByMetaAnnotationOnSetter() { try { TestAnnotation annotation = setInvalidPropertyMethod.getByMetaAnnotation(TestMetaAnnotation.class); fail("Expecting " + XOException.class); } catch (XOException e) { assertThat(e.getMessage(), containsString("setInvalidProperty")); } }