EvalFunctionCall implements Serializable { public Map<String, DataType> getChannelsAndTypes() { return channelNamesMapping.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getValue, entry -> { Optional<FunctionParameter> fp = Arrays.stream(getEvalFunction().getFunctionDef().getSignature().getParameters()) .filter(functionParameter -> entry.getKey().equals(functionParameter.getName())) .findFirst(); if (!fp.isPresent()) { throw new IllegalStateException("Asking for a channel \"" + entry.getKey() + "\" that is not present in the functions signature!"); } return fp.get().getDataType(); })); } EvalFunctionCall(EvalFunction evalFunction, Map<String, Value> literals, Map<String, String> channelNamesMapping);  EvalFunctionCall(EvalFunctionFactory factory, Map<String, Value> literals, Map<String, String> channelNamesMapping); EvalFunction getEvalFunction(); void setEvalFunction(EvalFunction evalFunction); HashMap<String, Value> getLiterals(); void setLiterals(Map<String, Value> literals); Map<String, String> getChannelNamesMapping(); void setChannelNamesMapping(Map<String, String> channelNamesMapping); Map<String, DataType> getChannelsAndTypes();  }
@Test public void shouldGetNecessaryChannelsAndTypes_fromEvalFunctionCall() throws Exception { EvalFunctionCall call = new EvalFunctionCall(new AnnotatedEvalFunctionWrapper<>(RegexFind2.class), Collections.singletonMap("regex", Value.of("nothing")), Collections.singletonMap("value", "DB14_Channel123")); Map<String, DataType> channelsAndTypes = call.getChannelsAndTypes(); assertEquals(1, channelsAndTypes.size()); assertEquals(DataType.STRING, channelsAndTypes.get("DB14_Channel123")); }