### Question:
FieldReferMetadataCreator implements ReferMetadataCreator { @Override public boolean isApplicable(Type type, String ref) { Field field; try { field = TypeUtils.getRawType(type, null).getField(ref); } catch (NoSuchFieldException e) { return false; } return Modifier.isPublic(field.getModifiers()); }  @Override boolean isApplicable(Type type, String ref); @Override ReferMetadata getReferMetadata(Type type, String path);  }### Answer:
@Test void shouldCheckIfApplicableWhenFieldIsPublic() { FieldReferMetadataCreator fieldBased = new FieldReferMetadataCreator(); boolean applicable = fieldBased.isApplicable(TestClass.class, "publicField"); assertThat(applicable).isTrue(); }
@Test void shouldCheckIfApplicableWhenFieldIsPrivate() { FieldReferMetadataCreator fieldBased = new FieldReferMetadataCreator(); boolean applicable = fieldBased.isApplicable(TestClass.class, "privateField"); assertThat(applicable).isFalse(); }
@Test void shouldCheckIfApplicableWhenNoField() { FieldReferMetadataCreator fieldBased = new FieldReferMetadataCreator(); boolean applicable = fieldBased.isApplicable(TestClass.class, "notExistingField"); assertThat(applicable).isFalse(); }