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