test_class.declarator: fieldNormalizer
test_class.modifier: private
test_class.original_string: private FieldNormalizer<FruitNameContainer> fieldNormalizer;
test_class.type: FieldNormalizer<FruitNameContainer>
test_class.var_name: fieldNormalizer
test_class.declarator: firstDistanceCalculatorMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RootTermDistanceCalculator firstDistanceCalculatorMock;
test_class.type: RootTermDistanceCalculator
test_class.var_name: firstDistanceCalculatorMock
test_class.declarator: secondDistanceCalculatorMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RootTermDistanceCalculator secondDistanceCalculatorMock;
test_class.type: RootTermDistanceCalculator
test_class.var_name: secondDistanceCalculatorMock
test_class.file: backend/project-board/src/test/java/de/adesso/projectboard/base/normalizer/FieldNormalizerTest.java
test_class.identifier: FieldNormalizerTest
test_case.body: @Test
      public void normalizeNormalizesLobOfAllContainers() {
          // given
          var firstContainerName = "red thing";
          var normalizedFirstContainerName = "Tomato";
          var firstContainer = new FruitNameContainer(firstContainerName);
          var normalizedFirstContainer = new FruitNameContainer(normalizedFirstContainerName);
  
          var secondContainerName = "green thing";
          var normalizedSecondContainerName = "Apple";
          var secondContainer = new FruitNameContainer(secondContainerName);
          var normalizedSecondContainer = new FruitNameContainer(normalizedSecondContainerName);
  
          var givenContainers = List.of(firstContainer, secondContainer);
          var expectedNormalizedContainers = List.of(normalizedFirstContainer, normalizedSecondContainer);
  
          given(firstDistanceCalculatorMock.getOriginalRootTerm()).willReturn(normalizedFirstContainerName);
          given(firstDistanceCalculatorMock.calculateMinimalDistance(any())).willReturn(100);
          given(firstDistanceCalculatorMock.calculateMinimalDistance(firstContainerName)).willReturn(0);
  
          given(secondDistanceCalculatorMock.getOriginalRootTerm()).willReturn(normalizedSecondContainerName);
          given(secondDistanceCalculatorMock.calculateMinimalDistance(any())).willReturn(100);
          given(secondDistanceCalculatorMock.calculateMinimalDistance(secondContainerName)).willReturn(0);
  
          // when
          var actualNormalizedContainers = fieldNormalizer.normalize(givenContainers);
  
          // then
          assertThat(actualNormalizedContainers).containsExactlyInAnyOrderElementsOf(expectedNormalizedContainers);
      }
test_case.class_method_signature: FieldNormalizerTest.normalizeNormalizesLobOfAllContainers()
test_case.full_signature: @Test public void normalizeNormalizesLobOfAllContainers()
test_case.identifier: normalizeNormalizesLobOfAllContainers
test_case.invocations: of of willReturn given getOriginalRootTerm willReturn given calculateMinimalDistance any willReturn given calculateMinimalDistance willReturn given getOriginalRootTerm willReturn given calculateMinimalDistance any willReturn given calculateMinimalDistance normalize containsExactlyInAnyOrderElementsOf assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void normalizeNormalizesLobOfAllContainers()
focal_class.declarator: fieldDistanceCalculators
focal_class.modifier: private final
focal_class.original_string: private final Set<RootTermDistanceCalculator> fieldDistanceCalculators;
focal_class.type: Set<RootTermDistanceCalculator>
focal_class.var_name: fieldDistanceCalculators
focal_class.file: backend/project-board/src/main/java/de/adesso/projectboard/base/normalizer/FieldNormalizer.java
focal_class.identifier: FieldNormalizer
focal_class.interfaces: implements Normalizer<T>
focal_class.class_method_signature: FieldNormalizer.FieldNormalizer(Set<RootTermDistanceCalculator> fieldDistanceCalculators)
focal_class.full_signature: protected  FieldNormalizer(Set<RootTermDistanceCalculator> fieldDistanceCalculators)
focal_class.identifier: FieldNormalizer
focal_class.modifiers: protected
focal_class.parameters: (Set<RootTermDistanceCalculator> fieldDistanceCalculators)
focal_class.signature:  FieldNormalizer(Set<RootTermDistanceCalculator> fieldDistanceCalculators)
focal_class.class_method_signature: FieldNormalizer.normalize(List<T> objectsToNormalize)
focal_class.full_signature: @Override public List<T> normalize(List<T> objectsToNormalize)
focal_class.identifier: normalize
focal_class.modifiers: @Override public
focal_class.parameters: (List<T> objectsToNormalize)
focal_class.return: List<T>
focal_class.signature: List<T> normalize(List<T> objectsToNormalize)
focal_class.class_method_signature: FieldNormalizer.getDistinctFieldValues(List<T> objectsToNormalize)
focal_class.full_signature: private Set<String> getDistinctFieldValues(List<T> objectsToNormalize)
focal_class.identifier: getDistinctFieldValues
focal_class.modifiers: private
focal_class.parameters: (List<T> objectsToNormalize)
focal_class.return: Set<String>
focal_class.signature: Set<String> getDistinctFieldValues(List<T> objectsToNormalize)
focal_class.class_method_signature: FieldNormalizer.getFieldValue(T fieldContainingObject)
focal_class.full_signature: abstract String getFieldValue(T fieldContainingObject)
focal_class.identifier: getFieldValue
focal_class.modifiers: abstract
focal_class.parameters: (T fieldContainingObject)
focal_class.return: String
focal_class.signature: String getFieldValue(T fieldContainingObject)
focal_class.class_method_signature: FieldNormalizer.setNormalizedFieldValue(T fieldContainingObject, String normalizedValue)
focal_class.full_signature: abstract T setNormalizedFieldValue(T fieldContainingObject, String normalizedValue)
focal_class.identifier: setNormalizedFieldValue
focal_class.modifiers: abstract
focal_class.parameters: (T fieldContainingObject, String normalizedValue)
focal_class.return: T
focal_class.signature: T setNormalizedFieldValue(T fieldContainingObject, String normalizedValue)
focal_method.body: @Override
      public List<T> normalize(List<T> objectsToNormalize) {
          var distinctValues = getDistinctFieldValues(objectsToNormalize);
  
          var normalizedLobMap = distinctValues.stream()
                  .collect(Collectors.toMap(
                          Function.identity(),
                          distinctValue -> RootTermDistanceCalculator.nearestRootTerm(fieldDistanceCalculators, distinctValue, 7)
                  ));
  
          return objectsToNormalize.parallelStream()
                  .map(objToNormalize -> {
                      var currentLob = getFieldValue(objToNormalize);
  
                      if(currentLob != null) {
                          var normalizedLob = normalizedLobMap.get(currentLob);
  
                          return setNormalizedFieldValue(objToNormalize, normalizedLob);
                      }
  
                      return objToNormalize;
                  })
          .collect(Collectors.toList());
      }
focal_method.class_method_signature: FieldNormalizer.normalize(List<T> objectsToNormalize)
focal_method.full_signature: @Override public List<T> normalize(List<T> objectsToNormalize)
focal_method.identifier: normalize
focal_method.invocations: getDistinctFieldValues collect stream toMap identity nearestRootTerm collect map parallelStream getFieldValue get setNormalizedFieldValue toList
focal_method.modifiers: @Override public
focal_method.parameters: (List<T> objectsToNormalize)
focal_method.return: List<T>
focal_method.signature: List<T> normalize(List<T> objectsToNormalize)