ExplicitNullableTypeChecker { public String checkValueForAnnotatedElement(Object value, AnnotatedElement annotatedElement) { if (annotatedElement.isAnnotationPresent(Nullable.class)) { return null; } if (annotatedElement instanceof Method) { return checkValueForType(value, ((Method) annotatedElement).getGenericReturnType()); } return null; }  String checkValueForAnnotatedElement(Object value,
            AnnotatedElement annotatedElement);  }
@Test public void should_ReturnNull_When_AnnotatedNullable() throws NoSuchMethodException { String error = explicitNullableTypeChecker .checkValueForAnnotatedElement(null, getClass().getMethod("stringNullable")); Assert.assertNull("Nullable return type should allow null value", error); error = explicitNullableTypeChecker.checkValueForAnnotatedElement( "Not null value", getClass().getMethod("stringNullable")); Assert.assertNull("Nullable return type should allow null value", error); }