@Test public void testParseShouldReturnEmptyListWhenNoSequenceDescriptorExists() { given(rootElement.getElementsByTagName(SEQUENCE_DESCRIPTOR_TAG_NAME)).willReturn(nodeList); given(nodeList.getLength()).willReturn(0); List<SequenceDescriptor> result = underTest.parse(document, rootElement, dialogDescriptors); assertTrue(result.isEmpty()); }
public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) { NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME); List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>(); for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) { Element sequenceElement = (Element) sequenceDescriptorNodes.item(i); SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors); sequenceDescriptors.add(sequenceDescriptor); } return sequenceDescriptors; }
SequenceDescriptorParser { public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) { NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME); List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>(); for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) { Element sequenceElement = (Element) sequenceDescriptorNodes.item(i); SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors); sequenceDescriptors.add(sequenceDescriptor); } return sequenceDescriptors; } }
SequenceDescriptorParser { public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) { NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME); List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>(); for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) { Element sequenceElement = (Element) sequenceDescriptorNodes.item(i); SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors); sequenceDescriptors.add(sequenceDescriptor); } return sequenceDescriptors; }  }
SequenceDescriptorParser { public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) { NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME); List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>(); for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) { Element sequenceElement = (Element) sequenceDescriptorNodes.item(i); SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors); sequenceDescriptors.add(sequenceDescriptor); } return sequenceDescriptors; }  List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors); }
SequenceDescriptorParser { public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) { NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME); List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>(); for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) { Element sequenceElement = (Element) sequenceDescriptorNodes.item(i); SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors); sequenceDescriptors.add(sequenceDescriptor); } return sequenceDescriptors; }  List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors);  }