Search in sources :

Example 1 with JooqRecordMapperWrapper

use of org.simpleflatmapper.jooq.JooqRecordMapperWrapper in project SimpleFlatMapper by arnaudroger.

the class JooqMapperTest method testCacheMapper.

@Test
@SuppressWarnings("unchecked")
public void testCacheMapper() {
    SfmRecordMapperProvider recordMapperProvider = new SfmRecordMapperProvider();
    RecordType rt = mock(RecordType.class);
    Field field1 = mock(Field.class);
    when(field1.getName()).thenReturn("id");
    when(field1.getType()).thenReturn(long.class);
    when(rt.size()).thenReturn(1);
    when(rt.fields()).thenReturn(new Field[] { field1 });
    JooqRecordMapperWrapper provider1 = (JooqRecordMapperWrapper) recordMapperProvider.<Record, DbObject>provide(rt, DbObject.class);
    JooqRecordMapperWrapper provider2 = (JooqRecordMapperWrapper) recordMapperProvider.<Record, DbObject>provide(rt, DbObject.class);
    assertSame(provider1.getMapper(), provider2.getMapper());
}
Also used : JooqRecordMapperWrapper(org.simpleflatmapper.jooq.JooqRecordMapperWrapper) DbObject(org.simpleflatmapper.test.beans.DbObject) SfmRecordMapperProvider(org.simpleflatmapper.jooq.SfmRecordMapperProvider) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 JooqRecordMapperWrapper (org.simpleflatmapper.jooq.JooqRecordMapperWrapper)1 SfmRecordMapperProvider (org.simpleflatmapper.jooq.SfmRecordMapperProvider)1 DbObject (org.simpleflatmapper.test.beans.DbObject)1