@Test public void testGetBoundProperty_FailsIfNoBoundPropertyAnnotationPresent() throws Exception { try { BoundPropertyAnnotationReader.getBoundProperty(BoundPropertyAnnotationReaderTest.class.getField("foo")); fail("expected an " + IllegalArgumentException.class.getSimpleName()); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString(BoundPropertyAnnotationReaderTest.class.getSimpleName())); assertThat(e.getMessage(), containsString("foo")); assertThat(e.getMessage(), containsString("isBoundPropertyPresent")); } }
public static BoundProperty getBoundProperty(AnnotatedElement annotatedElement) { return findBoundProperty(annotatedElement) .orElseThrow(() -> new IllegalArgumentException( String.format("%s has no annotation that defines a %s. You can call " + BoundPropertyAnnotationReader.class.getSimpleName() + "#isBoundPropertyPresent(AnnotatedElement) to safeguard against this.", annotatedElement, BoundPropertyCreator.class.getName()))); }
BoundPropertyAnnotationReader { public static BoundProperty getBoundProperty(AnnotatedElement annotatedElement) { return findBoundProperty(annotatedElement) .orElseThrow(() -> new IllegalArgumentException( String.format("%s has no annotation that defines a %s. You can call " + BoundPropertyAnnotationReader.class.getSimpleName() + "#isBoundPropertyPresent(AnnotatedElement) to safeguard against this.", annotatedElement, BoundPropertyCreator.class.getName()))); } }
BoundPropertyAnnotationReader { public static BoundProperty getBoundProperty(AnnotatedElement annotatedElement) { return findBoundProperty(annotatedElement) .orElseThrow(() -> new IllegalArgumentException( String.format("%s has no annotation that defines a %s. You can call " + BoundPropertyAnnotationReader.class.getSimpleName() + "#isBoundPropertyPresent(AnnotatedElement) to safeguard against this.", annotatedElement, BoundPropertyCreator.class.getName()))); } private  BoundPropertyAnnotationReader(); }
BoundPropertyAnnotationReader { public static BoundProperty getBoundProperty(AnnotatedElement annotatedElement) { return findBoundProperty(annotatedElement) .orElseThrow(() -> new IllegalArgumentException( String.format("%s has no annotation that defines a %s. You can call " + BoundPropertyAnnotationReader.class.getSimpleName() + "#isBoundPropertyPresent(AnnotatedElement) to safeguard against this.", annotatedElement, BoundPropertyCreator.class.getName()))); } private  BoundPropertyAnnotationReader(); static boolean isBoundPropertyPresent(AnnotatedElement annotatedElement); static BoundProperty getBoundProperty(AnnotatedElement annotatedElement); static Optional<BoundProperty> findBoundProperty(AnnotatedElement annotatedElement); static BoundProperty getBoundProperty(A annotation,
            AnnotatedElement annotatedElement); }
BoundPropertyAnnotationReader { public static BoundProperty getBoundProperty(AnnotatedElement annotatedElement) { return findBoundProperty(annotatedElement) .orElseThrow(() -> new IllegalArgumentException( String.format("%s has no annotation that defines a %s. You can call " + BoundPropertyAnnotationReader.class.getSimpleName() + "#isBoundPropertyPresent(AnnotatedElement) to safeguard against this.", annotatedElement, BoundPropertyCreator.class.getName()))); } private  BoundPropertyAnnotationReader(); static boolean isBoundPropertyPresent(AnnotatedElement annotatedElement); static BoundProperty getBoundProperty(AnnotatedElement annotatedElement); static Optional<BoundProperty> findBoundProperty(AnnotatedElement annotatedElement); static BoundProperty getBoundProperty(A annotation,
            AnnotatedElement annotatedElement);  }