### Question:
FunctionParser { public static List<Object> parseFunctionWithScalarOrArrayArguments(String string, String errorMessage) { return parseFunctionWithScalarOrArrayArguments("(\\w+)", string, errorMessage); }  static List<Object> parseFunctionWithScalarOrArrayArguments(String string, String errorMessage); static List<Object> parseFunctionWithScalarOrArrayArguments(String nameRegex, String string, String errorMessage); static Object asScalarOrList(List<Object> objects); static ListDouble asListDouble(List<Object> objects); static List<String> asListString(List<Object> objects); static List<Object> parseFunctionAnyParameter(String string); static List<Object> parseFunctionAnyParameter(String nameRegex, String string);  }### Answer:
@Test public void parseFunctionWithScalarOrArrayArguments1() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(1.0)", "error"); assertThat(parameters, equalTo(Arrays.asList((Object) "foo", 1.0))); }
@Test public void parseFunctionWithScalarOrArrayArguments2() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(\"test\")", "error"); assertThat(parameters, equalTo(Arrays.asList((Object) "foo", "test"))); }
@Test public void parseFunctionWithScalarOrArrayArguments3() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(1,2,3)", "error"); assertThat(parameters.get(0), equalTo((Object) "foo")); assertThat(parameters.get(1), equalTo((Object) new ArrayDouble(1.0,2.0,3.0))); }
@Test public void parseFunctionWithScalarOrArrayArguments4() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(\"a\", \"b\", \"c\")", "error"); assertThat(parameters.get(0), equalTo((Object) "foo")); assertThat(parameters.get(1), equalTo((Object) Arrays.asList("a", "b", "c"))); }
@Test public void parseFunctionWithScalarOrArrayArguments5() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(\"It\\\'s \\u0061n escaped parameter\")", "error"); assertThat(parameters.get(0), equalTo((Object) "foo")); assertThat(parameters.get(1), equalTo((Object) "It\'s an escaped parameter")); }
@Test public void parseFunctionWithScalarOrArrayArguments6() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(\"\\u0061\", \"b\", \"\\u0063\")", "error"); assertThat(parameters.get(0), equalTo((Object) "foo")); assertThat(parameters.get(1), equalTo((Object) Arrays.asList("a", "b", "c"))); }
@Test public void parseFunctionWithScalarOrArrayArguments7() { List<Object> parameters = FunctionParser.parseFunctionWithScalarOrArrayArguments("foo(\"I said \\\"Right!\\\"\")", "error"); assertThat(parameters.get(0), equalTo((Object) "foo")); assertThat(parameters.get(1), equalTo((Object) "I said \"Right!\"")); }