Nullable { public static boolean isNullable(Field field) { for( Annotation a : field.getAnnotations() ) if( Strings.equals("Nullable",a.annotationType().getSimpleName())) return true; return false; } private  Nullable(); static boolean notNullable( Field field ); static boolean isNullable(Field field);  }
@Test public void shouldRejectNullFields() throws Exception { assertThat(roboguice.inject.Nullable.isNullable(DummyClass.class.getDeclaredField("notNullable")), is(false)); }
@Test public void shouldAcceptNonNullFields() throws Exception { assertThat(roboguice.inject.Nullable.isNullable(DummyClass.class.getDeclaredField("nullable")), is(true)); }