@Test void createRowMapperXref() throws Exception { Attribute refIdAttr = mock(Attribute.class); when(refIdAttr.getDataType()).thenReturn(STRING); EntityType refEntityType = mock(EntityType.class); when(refEntityType.getIdAttribute()).thenReturn(refIdAttr); String xrefAttr = "xrefAttr"; Attribute oneToManyAttr = mock(Attribute.class); when(oneToManyAttr.getName()).thenReturn(xrefAttr); when(oneToManyAttr.getDataType()).thenReturn(XREF); when(oneToManyAttr.getRefEntity()).thenReturn(refEntityType); EntityType entityType = mock(EntityType.class); when(entityType.getAtomicAttributes()).thenReturn(singleton(oneToManyAttr)); ResultSet rs = mock(ResultSet.class); when(rs.getString(xrefAttr)).thenReturn("id0"); int rowNum = 0; Entity entity = mock(Entity.class); when(entityManager.createFetch(entityType, null)).thenReturn(entity); Entity refEntity = mock(Entity.class); when(entityManager.getReference(refEntityType, "id0")).thenReturn(refEntity); assertEquals( entity, postgreSqlEntityFactory.createRowMapper(entityType, null).mapRow(rs, rowNum)); verify(entity).set(xrefAttr, refEntity); }
EntityMapper createRowMapper(EntityType entityType, Fetch fetch) { return new EntityMapper(entityManager, entityType, fetch); }
PostgreSqlEntityFactory { EntityMapper createRowMapper(EntityType entityType, Fetch fetch) { return new EntityMapper(entityManager, entityType, fetch); } }
PostgreSqlEntityFactory { EntityMapper createRowMapper(EntityType entityType, Fetch fetch) { return new EntityMapper(entityManager, entityType, fetch); } PostgreSqlEntityFactory(EntityManager entityManager); }
PostgreSqlEntityFactory { EntityMapper createRowMapper(EntityType entityType, Fetch fetch) { return new EntityMapper(entityManager, entityType, fetch); } PostgreSqlEntityFactory(EntityManager entityManager);  }
PostgreSqlEntityFactory { EntityMapper createRowMapper(EntityType entityType, Fetch fetch) { return new EntityMapper(entityManager, entityType, fetch); } PostgreSqlEntityFactory(EntityManager entityManager);   }