@Test public void convertCommonCourts() { CommonCourt commonCourtOne = new CommonCourt(); commonCourtOne.setName(commonCourtNames[0]); commonCourtOne.setType(CommonCourtType.DISTRICT); Whitebox.setInternalState(commonCourtOne, "id", 83); CommonCourt commonCourtTwo = new CommonCourt(); commonCourtTwo.setName(commonCourtNames[1]); commonCourtTwo.setType(CommonCourtType.APPEAL); Whitebox.setInternalState(commonCourtTwo, "id", 257); List<CommonCourt> commonCourts = Lists.newArrayList(commonCourtOne, commonCourtTwo); List<SimpleCommonCourt> convertedSimpleEntities = simpleCommonCourtConverter.convertCommonCourts(commonCourts); assertEquals(commonCourts.size(), convertedSimpleEntities.size()); assertEquals(83, convertedSimpleEntities.get(0).getId()); assertEquals(commonCourtNames[0], convertedSimpleEntities.get(0).getName()); assertEquals(CommonCourtType.DISTRICT, convertedSimpleEntities.get(0).getType()); assertEquals(257, convertedSimpleEntities.get(1).getId()); assertEquals(commonCourtNames[1], convertedSimpleEntities.get(1).getName()); assertEquals(CommonCourtType.APPEAL, convertedSimpleEntities.get(1).getType()); }
public List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts) { if (CollectionUtils.isEmpty(commonCourts)) { return Lists.newArrayList(); } return commonCourts.stream() .map(commonCourt -> convertFromCommonCourt(commonCourt)) .collect(Collectors.toList()); }
SimpleCommonCourtConverter { public List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts) { if (CollectionUtils.isEmpty(commonCourts)) { return Lists.newArrayList(); } return commonCourts.stream() .map(commonCourt -> convertFromCommonCourt(commonCourt)) .collect(Collectors.toList()); } }
SimpleCommonCourtConverter { public List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts) { if (CollectionUtils.isEmpty(commonCourts)) { return Lists.newArrayList(); } return commonCourts.stream() .map(commonCourt -> convertFromCommonCourt(commonCourt)) .collect(Collectors.toList()); }  }
SimpleCommonCourtConverter { public List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts) { if (CollectionUtils.isEmpty(commonCourts)) { return Lists.newArrayList(); } return commonCourts.stream() .map(commonCourt -> convertFromCommonCourt(commonCourt)) .collect(Collectors.toList()); }  List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts); }
SimpleCommonCourtConverter { public List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts) { if (CollectionUtils.isEmpty(commonCourts)) { return Lists.newArrayList(); } return commonCourts.stream() .map(commonCourt -> convertFromCommonCourt(commonCourt)) .collect(Collectors.toList()); }  List<SimpleCommonCourt> convertCommonCourts(List<CommonCourt> commonCourts);  }