BuiltinFunctionRepository { public FunctionImplementation compile(FunctionName functionName, List<Expression> expressions) { FunctionBuilder resolvedFunctionBuilder = resolve(new FunctionSignature(functionName, expressions.stream().map(expression -> expression.type()).collect(Collectors.toList()))); return resolvedFunctionBuilder.apply(expressions); }  void register(FunctionResolver resolver); FunctionImplementation compile(FunctionName functionName, List<Expression> expressions); FunctionBuilder resolve(FunctionSignature functionSignature);  }
@Test void compile() { when(mockfunctionResolver.getFunctionName()).thenReturn(mockFunctionName); when(mockfunctionResolver.resolve(any())).thenReturn(functionExpressionBuilder); when(mockMap.containsKey(any())).thenReturn(true); when(mockMap.get(any())).thenReturn(mockfunctionResolver); BuiltinFunctionRepository repo = new BuiltinFunctionRepository(mockMap); repo.register(mockfunctionResolver); repo.compile(mockFunctionName, Arrays.asList(mockExpression)); verify(functionExpressionBuilder, times(1)).apply(any()); }