@Test
public void getConnectionForExistingHook() throws Exception {

    expect(mockContext.lookup(eq("java:comp/env/hook")))
        .andReturn(mockDataSource);
    expect(mockDataSource.getConnection()).andReturn(mockConnection);
    EasyMockUnitils.replay();
    final Connection connection = factory.getConnection("hook");
    assertSame("Unexpected connection returned",
            mockConnection, connection);
}