MarkerToActivityConverter { Element buildCoverageMarkerMessage(Element msgElement, IActivity a) { Document msgDoc = msgElement.getOwnerDocument(); List<? extends IDocumentation> documentation = a.getDocumentation(); if (documentation != null && documentation.size() > 0) { IDocumentation firstDoc = documentation.get(0); for (Node n : firstDoc.getDocumentationElements()) { if (isMarkerElement(n)) { Element markerElement = msgDoc.createElementNS( CoverageConstants.MARKER_SERVICE_NAMESPACE, CoverageConstants.COVERAGE_MSG_MARKER_ELEMENT); XMLUtil.appendTextNode(markerElement, XMLUtil.getTextContent(n)); msgElement.appendChild(markerElement); } } } return msgElement; }  void convertMarkersToActivities(IBPELUnitContext context);  }
@Test public void testCreateRequestForMarkersNoMarkers() throws Exception { markerToActivityConverter.buildCoverageMarkerMessage(markerMsg, activity); assertEquals(0, markerMsg.getChildNodes().getLength()); }
@Test public void testCreateRequestForMarkersThreeMarkers() throws Exception { addThreeMarkersToActivity(); assertEquals(3, activity.getDocumentation().get(0).getDocumentationElements().size()); markerToActivityConverter.buildCoverageMarkerMessage(markerMsg, activity); NodeList children = markerMsg.getChildNodes(); assertEquals(3, children.getLength()); assertEquals(marker1.getName(), children.item(0).getTextContent()); assertEquals(marker2.getName(), children.item(1).getTextContent()); assertEquals(marker3.getName(), children.item(2).getTextContent()); }