ProcessDefinitionMapper implements Function<ProcessDefinition, ProcessDefinitionSummary> { @Override public ProcessDefinitionSummary apply(final ProcessDefinition cd) { if (cd == null) { return null; } return ProcessDefinitionSummary.builder(). id(cd.getId()). name(cd.getName()). containerId(cd.getContainerId()). version(cd.getVersion()). packageName(cd.getPackageName()). build(); }  @Override ProcessDefinitionSummary apply(final ProcessDefinition cd);  }
@Test public void testProcessDefinitionMapper_mapProcessDefinition() { final ProcessDefinition pd = new ProcessDefinition(); pd.setId("org.jbpm.case"); pd.setName("New case"); pd.setContainerId("org.jbpm"); pd.setVersion("1.0"); pd.setPackageName("packageName"); final ProcessDefinitionSummary pds = new ProcessDefinitionMapper().apply(pd); assertCaseDefinition(pd, pds); }
@Test public void testCaseDefinitionMapper_mapNull() { final CaseDefinition cd = null; final CaseDefinitionSummary cds = new CaseDefinitionMapper().apply(cd); assertNull(cds); }