### Question:
GetterReferMetadataCreator implements ReferMetadataCreator { @Override public ReferMetadata getReferMetadata(Type type, String path) { Class<?> classType = getRawType(type); List<String> gettersNames = createGettersNames(classType, path.replace("[*]", "")); Method getterMethod = gettersNames.stream() .flatMap(getter -> Arrays.stream(classType.getMethods()) .filter(method -> method.getParameterCount() == 0) .filter(method -> method.getName().equals(getter))) .findFirst() .get(); String getterName = getterMethod.getName() + "()"; Type refType = getterMethod.getGenericReturnType(); return new ReferMetadata(refType, getterName, path); }  @Override boolean isApplicable(Type type, String ref); @Override ReferMetadata getReferMetadata(Type type, String path);  }### Answer:
@Test void shouldCreateMetadataForSimpleGetterWithNoGroupingOperator() { GetterReferMetadataCreator getterBased = new GetterReferMetadataCreator(); ReferMetadata referMetadata = getterBased.getReferMetadata(SimpleGetterClass.class, "field"); ReferMetadata expected = new ReferMetadata(String.class, "getField()", "field"); assertThat(referMetadata).isEqualTo(expected); }
@Test void shouldCreateMetadataForSimpleGetterWithGroupingOperator() { GetterReferMetadataCreator getterBased = new GetterReferMetadataCreator(); ReferMetadata referMetadata = getterBased.getReferMetadata(SimpleGetterClass.class, "field[*]"); ReferMetadata expected = new ReferMetadata(String.class, "getField()", "field[*]"); assertThat(referMetadata).isEqualTo(expected); }
@Test void shouldCreateMetadataForBooleanGetterWithNoGroupingOperator() { GetterReferMetadataCreator getterBased = new GetterReferMetadataCreator(); ReferMetadata referMetadata = getterBased.getReferMetadata(BooleanFieldGetterClass.class, "field"); ReferMetadata expected = new ReferMetadata(boolean.class, "isField()", "field"); assertThat(referMetadata).isEqualTo(expected); }
@Test void shouldCreateMetadataForBooleanGetterWithGroupingOperator() { GetterReferMetadataCreator getterBased = new GetterReferMetadataCreator(); ReferMetadata referMetadata = getterBased.getReferMetadata(BooleanFieldGetterClass.class, "field[*]"); ReferMetadata expected = new ReferMetadata(boolean.class, "isField()", "field[*]"); assertThat(referMetadata).isEqualTo(expected); }