### Question:
StringFunctionExecutor { public static StringFunctionExecutor getInstance(String functionDefinition) { StringFunctionExecutor executor = cache.get(functionDefinition); if(executor == null) { executor = new StringFunctionExecutor(functionDefinition, StringFunctionDefinitionParser.parse(functionDefinition)); StringFunctionExecutor existing = cache.putIfAbsent(functionDefinition, executor); if(existing != null) { executor = existing; } } return executor; } private  StringFunctionExecutor(String functionDefinition, List<StringFunction> functions); static StringFunctionExecutor getInstance(String functionDefinition); String execute(String input); @Override String toString();  }### Answer:
@Test public void test_caching() { String def1 = LOWER_CASE_DEFINITION; StringFunctionExecutor executor1 = StringFunctionExecutor.getInstance(def1); StringFunctionExecutor executor2 = StringFunctionExecutor.getInstance(def1); assertSame(executor1, executor2); String def2 = TRIM_DEFINITION + SEPARATOR + UPPER_CASE_DEFINITION; StringFunctionExecutor executor3 = StringFunctionExecutor.getInstance(def2); StringFunctionExecutor executor4 = StringFunctionExecutor.getInstance(def2); assertSame(executor3, executor4); assertNotSame(executor1, executor3); StringFunctionExecutor executor5 = StringFunctionExecutor.getInstance(def1); assertSame(executor1, executor5); }