You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ol...@apache.org on 2003/11/10 13:55:40 UTC

cvs commit: db-ojb/src/test/org/apache/ojb/broker/sqlcount AbstractCountTest.java

oliverm     2003/11/10 04:55:40

  Modified:    src/test/org/apache/ojb/broker/sqlcount
                        AbstractCountTest.java
  Log:
  new method
  assertStmtCount(String msg, int minExpected, int maxExpected)
  
  Revision  Changes    Path
  1.3       +19 -8     db-ojb/src/test/org/apache/ojb/broker/sqlcount/AbstractCountTest.java
  
  Index: AbstractCountTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/sqlcount/AbstractCountTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractCountTest.java	27 Oct 2003 15:49:15 -0000	1.2
  +++ AbstractCountTest.java	10 Nov 2003 12:55:40 -0000	1.3
  @@ -46,24 +46,35 @@
   
     /**
      * assert that the number of statements issued since the last call of {@link #resetStmtCount()}.
  -   * is equal to a specified number.
  +   * is between two specified numbers.
      *
      * @param msg short description of the actions since the last call of {@link #resetStmtCount()}.
      */
  -  protected final void assertStmtCount(String msg, int expected)
  +  protected final void assertStmtCount(String msg, int minExpected, int maxExpected)
     {
       int stmtNum = CountLogger.getSQLStatementCount() - stmtCount;
  -    if (stmtNum > expected)
  -      fail(msg + ": more SQL statements than expected. Expected: " + expected + ", was: " + stmtNum);
  -    else if (expected > 0 && stmtNum == 0)
  +    if (stmtNum > maxExpected)
  +      fail(msg + ": more SQL statements than expected. Expected: " + maxExpected + ", was: " + stmtNum);
  +    else if (minExpected > 0 && stmtNum == 0)
         fail("No SQL statements, maybe CountLogger not enabled?");
  -    else if (stmtNum < expected)
  +    else if (stmtNum < minExpected)
         fail(msg + ": less SQL statements than expected (Performance improvement? Please correct test limit)."
  -               +  " Expected: " + expected + ", was: " + stmtNum);
  +               +  " Expected: " + minExpected + ", was: " + stmtNum);
       else
       {
         logStmtCount(msg, stmtNum);
       }
  +  }
  +
  +  /**
  +   * assert that the number of statements issued since the last call of {@link #resetStmtCount()}.
  +   * is equal to a specified number.
  +   *
  +   * @param msg short description of the actions since the last call of {@link #resetStmtCount()}.
  +   */
  +  protected final void assertStmtCount(String msg, int expected)
  +  {
  +    assertStmtCount(msg, expected, expected);
     }
   
     private void logStmtCount(String msg, int num)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org