CaseDefinitionMapper implements Function<CaseDefinition, CaseDefinitionSummary> { @Override public CaseDefinitionSummary apply(final CaseDefinition cd) { if (cd == null) { return null; } return CaseDefinitionSummary.builder(). id(cd.getIdentifier()). name(cd.getName()). containerId(cd.getContainerId()). roles(cd.getRoles()). build(); }  @Override CaseDefinitionSummary apply(final CaseDefinition cd);  }
@Test public void testCaseDefinitionMapper_mapCaseDefinition() { final CaseDefinition cd = new CaseDefinition(); cd.setIdentifier("org.jbpm.case"); cd.setName("New case"); cd.setContainerId("org.jbpm"); cd.setRoles(Collections.singletonMap("participant", 2)); final CaseDefinitionSummary cds = new CaseDefinitionMapper().apply(cd); assertCaseDefinition(cd, cds); }
@Test public void testCaseDefinitionMapper_mapNull() { final CaseDefinition cd = null; final CaseDefinitionSummary cds = new CaseDefinitionMapper().apply(cd); assertNull(cds); }