DerivedFieldFunctionUtils { static Map<String, MethodDeclaration> getDerivedFieldsMethodMap(final List<DerivedField> derivedFields, final AtomicInteger arityCounter) { Map<String, MethodDeclaration> toReturn = new HashMap<>(); derivedFields.forEach(derivedField -> toReturn.put(derivedField.getName().getValue(), getDerivedFieldMethodDeclaration(derivedField, arityCounter))); return toReturn; } private  DerivedFieldFunctionUtils();   }
@Test(expected = KiePMMLException.class) public void getDerivedFieldsMethodMapUnsupportedExpression() { List<DerivedField> derivedFields = unsupportedExpressionSupplier.stream().map(derivedFieldCreator).collect(Collectors.toList()); AtomicInteger arityCounter = new AtomicInteger(); DerivedFieldFunctionUtils.getDerivedFieldsMethodMap(derivedFields, arityCounter); }
@Test public void getDerivedFieldsMethodMapSupportedExpression() { List<DerivedField> derivedFields = supportedExpressionSupplier.stream().map(derivedFieldCreator).collect(Collectors.toList()); AtomicInteger arityCounter = new AtomicInteger(); Map<String, MethodDeclaration> retrieved = DerivedFieldFunctionUtils.getDerivedFieldsMethodMap(derivedFields, arityCounter); assertEquals(derivedFields.size(), retrieved.size()); }