SequenceDescriptorAttributesParser implements NodeParser<SequenceDescriptorAttributes> { @Override public SequenceDescriptorAttributes parseNode(final Node node, final Document document) { SequenceDescriptorAttributes result; Element sequenceElement = (Element) node; String groupName = document.getDocumentElement().getAttribute("groupname"); String name = sequenceElement.getAttribute("name"); String sequenceHandlerClassName = sequenceElement.getAttribute("class"); long timeout = getTimeout(sequenceElement); ParameterList parameters = getParameters(sequenceElement); SequenceHandler sequenceHandler = sequenceHandlerInitializer.getExternalClassObject(sequenceHandlerClassName); result = new SequenceDescriptorAttributes.Builder().handler(sequenceHandler).name(name).groupname(groupName).defaultTimeout(timeout) .parameterList(parameters).build(); return result; }  @Override SequenceDescriptorAttributes parseNode(final Node node, final Document document);  }
@Test public void testParseNodeWhenThereIsNoParameter() { given(nodes.getLength()).willReturn(0); given(element.getAttribute("name")).willReturn(SEQUENCE_DESCRIPTOR_NAME); given(element.getAttribute("class")).willReturn(SEQUENCE_HANDLER_CLASS_NAME); given(element.getAttribute("timeout")).willReturn(""); given(stubConfigurationAccess.getProperties()).willReturn(value); given(value.getDefaultSequenceTimeout()).willReturn(9000L); DummySequenceHandler dummySequenceHandler = new DummySequenceHandler(); given(sequenceHandlerInitializer.getExternalClassObject(SEQUENCE_HANDLER_CLASS_NAME)).willReturn(dummySequenceHandler); SequenceDescriptorAttributes result = underTest.parseNode(element, document); assertEquals(SEQUENCE_DESCRIPTOR_NAME, result.getName()); assertEquals(9000L, result.getDefaultTimeout()); assertEquals(GROUP_NAME, result.getGroupName()); assertEquals(dummySequenceHandler, result.getHandler()); }