### Question:
GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); GenericServiceTaskValue getGenericServiceTask(); static String getServiceImplementation(String implementation); boolean isAsync(); boolean isAdHocAutostart(); String getSLADueDate(); static final String JAVA; static final String WEB_SERVICE; }### Answer:
@Test public void getGenericServiceTask() { GenericServiceTaskValue task = reader.getGenericServiceTask(); assertEquals("Java", task.getServiceImplementation()); assertEquals("serviceOperation", task.getServiceOperation()); assertEquals("serviceInterface", task.getServiceInterface()); assertEquals("inMessageStructure", task.getInMessageStructure()); assertEquals("outMessageStructure", task.getOutMessagetructure()); assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate()); assertEquals(false, reader.isAsync()); assertEquals(true, reader.isAdHocAutostart()); assertNotNull(reader.getOnEntryAction()); assertNotNull(reader.getOnExitAction()); assertNotNull(reader.getAssignmentsInfo()); }
@Test public void getGenericServiceTask() { GenericServiceTaskValue task = reader.getGenericServiceTask(); assertEquals("Java", task.getServiceImplementation()); assertEquals("serviceOperation", task.getServiceOperation()); assertEquals("serviceInterface", task.getServiceInterface()); assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate()); assertEquals(false, reader.isAsync()); assertEquals(true, reader.isAdHocAutostart()); assertNotNull(reader.getOnEntryAction()); assertNotNull(reader.getOnExitAction()); assertNotNull(reader.getAssignmentsInfo()); }