MysqlStatementCreator implements CallableStatementCreator { public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("CALL ").append(procedureName).append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); }  String createCall(String procedureName, int parameterCount);  }
@Test public void testCreate() { MysqlStatementCreator creator = new MysqlStatementCreator(); assertEquals("CALL mystoredProcedure(?, ?);", creator.createCall("mystoredProcedure", 2)); assertEquals("CALL mystoredProcedure();", creator.createCall("mystoredProcedure", 0)); }