CaseMilestoneMapper implements Function<CaseMilestone, CaseMilestoneSummary> { @Override public CaseMilestoneSummary apply(CaseMilestone cm) { if (cm == null) { return null; } return CaseMilestoneSummary.builder() .name(cm.getName()) .identifier(cm.getIdentifier()) .achieved(cm.isAchieved()) .achievedAt(cm.getAchievedAt()) .status(cm.getStatus()) .build(); }  @Override CaseMilestoneSummary apply(CaseMilestone cm);  }
@Test public void testCaseInstanceMapper() { final CaseMilestone cm = new CaseMilestone(); cm.setIdentifier("Milestone1"); cm.setName("Milestone 1"); cm.setAchieved(true); cm.setAchievedAt(new Date()); cm.setStatus("OPEN"); List<CaseMilestone> cmList = new ArrayList(); cmList.add(cm); final CaseMilestoneSummary cms = new CaseMilestoneMapper().apply(cm); assertCaseMilestone(cm, cms); }