### Question:
FieldReferMetadataCreator implements ReferMetadataCreator { @Override public ReferMetadata getReferMetadata(Type type, String path) { String pathWithoutOperator = path.replace("[*]", ""); Type refType; try { refType = TypeUtils.getRawType(type, null).getField(pathWithoutOperator).getGenericType(); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } return new ReferMetadata(refType, pathWithoutOperator, path); }  @Override boolean isApplicable(Type type, String ref); @Override ReferMetadata getReferMetadata(Type type, String path);  }### Answer:
@Test void shouldCreateMetadataWhenNoGroupingOperator() { FieldReferMetadataCreator fieldBased = new FieldReferMetadataCreator(); ReferMetadata referMetadata = fieldBased.getReferMetadata(TestClass.class, "publicField"); ReferMetadata expected = new ReferMetadata(boolean.class, "publicField", "publicField"); assertThat(referMetadata).isEqualTo(expected); }
@Test void shouldCreateMetadataWhenGroupingOperator() { FieldReferMetadataCreator fieldBased = new FieldReferMetadataCreator(); ReferMetadata referMetadata = fieldBased.getReferMetadata(TestClass.class, "publicField[*]"); ReferMetadata expected = new ReferMetadata(boolean.class, "publicField", "publicField[*]"); assertThat(referMetadata).isEqualTo(expected); }