Help save net neutrality! Learn more.
Close

#3 MockDataSource to provide getMockConnection()

closed
None
5
2005-05-01
2004-12-15
No

Rational is to remove cast to MockConnection from
frequently used code like

MockDataSource ds =
getJDBCMockObjectFactory().getMockDataSource();
MockConnection connection = (MockConnection)
ds.getConnection();

Discussion

  • Alwin Ibba

    Alwin Ibba - 2004-12-15
    • assigned_to: nobody --> aibba
     
  • Alwin Ibba

    Alwin Ibba - 2004-12-15

    Logged In: YES
    user_id=804648

    Thanks for the patch. I have some (very few) test cases that
    use MockDataSource with a different implementation of
    Connection. But I added a method

    public MockConnection getMockConnection()
    {
    if(connection instanceof MockConnection)
    {
    return (MockConnection)connection;
    }
    return null;
    }

    which should fulfil your purpose. Please note that instead
    of your code, you can also write

    MockConnection connection =
    getJDBCMockObjectFactory().getMockConnection();

    Regards,

    Alwin

     
  • Alwin Ibba

    Alwin Ibba - 2005-05-01
    • status: open --> closed