### Question:
NormalInvocation implements GeneratedInvocation { @Override public String getJavascriptCode() { return "\n" + functionName + "(" + Stream.of(parameters) .map(parameter -> "\"" + parameter + "\"") .collect(Collectors.joining(",")) + ");\n"; } NormalInvocation(String functionName, String... parameters); @Override String getJavascriptCode();  }### Answer:
@Test public void formattingIsCorrectIfNoParameters() { NormalInvocation normalInvocation = new NormalInvocation(FUNCTION_NAME); String expected = "\n" + FUNCTION_NAME + "();\n"; String actual = normalInvocation.getJavascriptCode(); assertEquals(expected, actual); }
@Test public void formattingIsCorrectIfOneParameter() { NormalInvocation normalInvocation = new NormalInvocation(FUNCTION_NAME, PARAMETER_1); String expected = format("\n{0}(\"{1}\");\n", FUNCTION_NAME, PARAMETER_1); String actual = normalInvocation.getJavascriptCode(); assertEquals(expected, actual); }
@Test public void formattingIsCorrectIfMultipleParameters() { NormalInvocation normalInvocation = new NormalInvocation(FUNCTION_NAME, PARAMETER_1, PARAMETER_2, PARAMETER_3); String expected = format("\n{0}(\"{1}\",\"{2}\",\"{3}\");\n", FUNCTION_NAME, PARAMETER_1, PARAMETER_2, PARAMETER_3); String actual = normalInvocation.getJavascriptCode(); assertEquals(expected, actual); }