#24 MockConnection.isValid(int) returns wrong value.

closed
Alwin Ibba
None
5
2008-06-27
2007-08-01
Dan Katzel
No

MockConnection.isValid(int timeout) returns the incorrectly value.

315 public boolean isValid(int timeout) throws SQLException
316 {
317 return isClosed();
318 }

The correct value should be to return !isClosed().

How to test:

public void testDisconnect() throws SQLException{

Connection conn=getJDBCMockObjectFactory().getMockConnection();
assertFalse(conn.isClosed());
assertTrue("connection should be valid before close",conn.isValid(5));

conn.close();
assertFalse("connection should not be valid after close",conn.isValid(5));
assertTrue(conn.isClosed());

}

Discussion

  • Alwin Ibba
    Alwin Ibba
    2007-08-01

    • assigned_to: nobody --> aibba
     
  • Alwin Ibba
    Alwin Ibba
    2007-08-01

    Logged In: YES
    user_id=804648
    Originator: NO

    Thanks for reporting this. I'll fix it.

     
  • Dan Katzel
    Dan Katzel
    2007-08-02

    Logged In: YES
    user_id=1625013
    Originator: YES

    Thank you!

    This is a great project.

     
  • Alwin Ibba
    Alwin Ibba
    2008-06-27

    • status: open --> closed