@SuppressWarnings("unchecked")
@Test
public void testForeignAutoRefresh() throws Exception {
Field field = ForeignAutoRefresh.class.getDeclaredField("foreign");
ConnectionSource connectionSource = createMock(ConnectionSource.class);
DatabaseConnection connection = createMock(DatabaseConnection.class);
expect(connectionSource.getDatabaseType()).andReturn(databaseType).anyTimes();
expect(connectionSource.getReadOnlyConnection()).andReturn(connection);
ForeignForeign foreignForeign = new ForeignForeign();
String stuff = "21312j3213";
int id = 4123123;
foreignForeign.id = id;
foreignForeign.stuff = stuff;
expect(
connection.queryForOne(isA(String.class), isA(Object[].class), isA(FieldType[].class),
isA(GenericRowMapper.class), (ObjectCache) isNull())).andReturn(foreignForeign);
connectionSource.releaseConnection(connection);
DatabaseResults results = createMock(DatabaseResults.class);
ForeignAutoRefresh foreign = new ForeignAutoRefresh();
replay(results, connectionSource, connection);