@Test public void should_map_entity_to_service_counterpart() throws Exception { JobUnit expected = mJobUnitMapper.transform(mJobUnitEntity); assertThat(expected.getId(), is(1)); assertThat(expected.getVersion(), is(100)); assertThat(expected.getLabel(), is("label")); assertThat(expected.getDescription(), is("description")); assertThat(expected.getReportUri(), is("/my/uri")); assertThat(expected.getReportLabel(), is("report label")); assertThat(expected.getOwner().toString(), is("jasperadmin|organization_1")); assertThat(expected.getState().toString(), is("NORMAL")); }
public List<JobUnit> transform(List<JobUnitEntity> entities) { List<JobUnit> list = new ArrayList<>(entities.size()); for (JobUnitEntity entity : entities) { if (entity != null) { JobUnit unit = transform(entity); list.add(unit); } } return list; }
JobUnitMapper { public List<JobUnit> transform(List<JobUnitEntity> entities) { List<JobUnit> list = new ArrayList<>(entities.size()); for (JobUnitEntity entity : entities) { if (entity != null) { JobUnit unit = transform(entity); list.add(unit); } } return list; } }
JobUnitMapper { public List<JobUnit> transform(List<JobUnitEntity> entities) { List<JobUnit> list = new ArrayList<>(entities.size()); for (JobUnitEntity entity : entities) { if (entity != null) { JobUnit unit = transform(entity); list.add(unit); } } return list; } JobUnitMapper(JobUnitDateParser jobUnitDateParser); }
JobUnitMapper { public List<JobUnit> transform(List<JobUnitEntity> entities) { List<JobUnit> list = new ArrayList<>(entities.size()); for (JobUnitEntity entity : entities) { if (entity != null) { JobUnit unit = transform(entity); list.add(unit); } } return list; } JobUnitMapper(JobUnitDateParser jobUnitDateParser); List<JobUnit> transform(List<JobUnitEntity> entities); JobUnit transform(JobUnitEntity entity); }
JobUnitMapper { public List<JobUnit> transform(List<JobUnitEntity> entities) { List<JobUnit> list = new ArrayList<>(entities.size()); for (JobUnitEntity entity : entities) { if (entity != null) { JobUnit unit = transform(entity); list.add(unit); } } return list; } JobUnitMapper(JobUnitDateParser jobUnitDateParser); List<JobUnit> transform(List<JobUnitEntity> entities); JobUnit transform(JobUnitEntity entity);  }