AttributeHelper { public CeType extractNhinCodedElement(Attribute attrib, String codeId) { LOG.debug("Entering AttributeHelper.extractNhinCodedElement..."); CeType ce = new CeType(); ce.setCode(""); ce.setCodeSystem(""); ce.setCodeSystemName(""); ce.setDisplayName(""); List<XMLObject> attrVals = attrib.getAttributeValues(); if (CollectionUtils.isNotEmpty(attrVals)) { LOG.trace("AttributeValue is: {}", attrVals.get(0).getClass()); NodeList nodelist = null; if (attrVals.get(0) instanceof XSAnyImpl) { XSAnyImpl elem = (XSAnyImpl) attrVals.get(0); nodelist = elem.getDOM().getChildNodes(); } else { LOG.error("The value for the {} attribute is a: {} expected an XSAnyImpl", codeId, attrVals.get(0).getClass()); } if (nodelist != null && nodelist.getLength() > 0) { int numNodes = nodelist.getLength(); for (int idx = 0; idx < numNodes; idx++) { compareAttrMap(nodelist, ce, codeId, idx); } } else { LOG.error("The AttributeValue for {} should have a Child Node", codeId); } } else { LOG.error("Attributes for {} are invalid: {} ", codeId, attrVals); } LOG.debug("Exiting AttributeHelper.extractNhinCodedElement..."); return ce; }  CeType extractNhinCodedElement(Attribute attrib, String codeId); String extractAttributeValueString(Attribute attrib); void extractNameParts(Attribute attrib, AssertionType assertOut);  }
@Test public final void testExtractNhinCodedElement() { Attribute attrib = mock(Attribute.class); List<XMLObject> attrVals = new ArrayList<>(); when(attrib.getAttributeValues()).thenReturn(attrVals); String CodeId = null; CeType ceTypeResult = helper.extractNhinCodedElement(attrib, CodeId); Assert.assertEquals("", ceTypeResult.getCode()); }