BuiltinFunctionRepository { public FunctionBuilder resolve(FunctionSignature functionSignature) { FunctionName functionName = functionSignature.getFunctionName(); if (functionResolverMap.containsKey(functionName)) { return functionResolverMap.get(functionName).resolve(functionSignature); } else { throw new ExpressionEvaluationException( String.format("unsupported function name: %s", functionName.getFunctionName())); } }  void register(FunctionResolver resolver); FunctionImplementation compile(FunctionName functionName, List<Expression> expressions); FunctionBuilder resolve(FunctionSignature functionSignature);  }
@Test @DisplayName("resolve registered function should pass") void resolve() { when(functionSignature.getFunctionName()).thenReturn(mockFunctionName); when(mockfunctionResolver.getFunctionName()).thenReturn(mockFunctionName); when(mockfunctionResolver.resolve(functionSignature)).thenReturn(functionExpressionBuilder); when(mockMap.containsKey(mockFunctionName)).thenReturn(true); when(mockMap.get(mockFunctionName)).thenReturn(mockfunctionResolver); BuiltinFunctionRepository repo = new BuiltinFunctionRepository(mockMap); repo.register(mockfunctionResolver); assertEquals(functionExpressionBuilder, repo.resolve(functionSignature)); }