@Test public void testGetMethodCallSyntax() { JavaScriptEngineFactory factory = new JavaScriptEngineFactory(); assertThat(factory.getMethodCallSyntax("obj", "method")).isEqualTo("obj.method()"); assertThat(factory.getMethodCallSyntax("obj", "method", "alpha")).isEqualTo("obj.method(alpha)"); assertThat(factory.getMethodCallSyntax("obj", "method", "alpha", "beta")).isEqualTo("obj.method(alpha,beta)"); }
@Override public String getMethodCallSyntax(String obj, String method, String... args) { StringBuilder s = new StringBuilder(); s.append(obj); s.append("."); s.append(method); s.append("("); for(int i = 0; i < args.length; i++) { if (i > 0) { s.append(","); } s.append(args[i]); } s.append(")"); return s.toString(); }
JavaScriptEngineFactory implements ScriptEngineFactory { @Override public String getMethodCallSyntax(String obj, String method, String... args) { StringBuilder s = new StringBuilder(); s.append(obj); s.append("."); s.append(method); s.append("("); for(int i = 0; i < args.length; i++) { if (i > 0) { s.append(","); } s.append(args[i]); } s.append(")"); return s.toString(); } }
JavaScriptEngineFactory implements ScriptEngineFactory { @Override public String getMethodCallSyntax(String obj, String method, String... args) { StringBuilder s = new StringBuilder(); s.append(obj); s.append("."); s.append(method); s.append("("); for(int i = 0; i < args.length; i++) { if (i > 0) { s.append(","); } s.append(args[i]); } s.append(")"); return s.toString(); }  }
JavaScriptEngineFactory implements ScriptEngineFactory { @Override public String getMethodCallSyntax(String obj, String method, String... args) { StringBuilder s = new StringBuilder(); s.append(obj); s.append("."); s.append(method); s.append("("); for(int i = 0; i < args.length; i++) { if (i > 0) { s.append(","); } s.append(args[i]); } s.append(")"); return s.toString(); }  @Override String getEngineName(); @Override String getEngineVersion(); @Override List<String> getExtensions(); @Override List<String> getMimeTypes(); @Override List<String> getNames(); @Override String getLanguageName(); @Override String getLanguageVersion(); @Override Object getParameter(String key); @Override String getMethodCallSyntax(String obj, String method, String... args); @Override String getOutputStatement(String toDisplay); @Override String getProgram(String... statements); @Override ScriptEngine getScriptEngine(); }
JavaScriptEngineFactory implements ScriptEngineFactory { @Override public String getMethodCallSyntax(String obj, String method, String... args) { StringBuilder s = new StringBuilder(); s.append(obj); s.append("."); s.append(method); s.append("("); for(int i = 0; i < args.length; i++) { if (i > 0) { s.append(","); } s.append(args[i]); } s.append(")"); return s.toString(); }  @Override String getEngineName(); @Override String getEngineVersion(); @Override List<String> getExtensions(); @Override List<String> getMimeTypes(); @Override List<String> getNames(); @Override String getLanguageName(); @Override String getLanguageVersion(); @Override Object getParameter(String key); @Override String getMethodCallSyntax(String obj, String method, String... args); @Override String getOutputStatement(String toDisplay); @Override String getProgram(String... statements); @Override ScriptEngine getScriptEngine();  }