Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3 MockDataSource to provide getMockConnection()

closed
Alwin Ibba
None
5
2005-05-01
2004-12-15
Gábor Lipták
No

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

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

Discussion

  • Gábor Lipták
    Gábor Lipták
    2004-12-15

    MockDataSource patch

     
    Attachments
  • 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