use of com.amalto.workbench.utils.callback.AttributeProcess in project tmdm-studio-se by Talend.
the class XmlUtilTest method testIterateAttribute.
/*
* iterateAttribute(Element element, AttributeProcess attributeProcess)
*/
@Test
public void testIterateAttribute() {
// $NON-NLS-1$
String tag = "name";
Element element = DocumentHelper.createElement(tag);
// $NON-NLS-1$ //$NON-NLS-2$
Attribute attr1 = DocumentHelper.createAttribute(element, "Attr1", "Value1");
// $NON-NLS-1$ //$NON-NLS-2$
Attribute attr2 = DocumentHelper.createAttribute(element, "Attr2", "Value2");
// $NON-NLS-1$ //$NON-NLS-2$
Attribute attr3 = DocumentHelper.createAttribute(element, "Attr3", "Value3");
element.add(attr1);
element.add(attr2);
element.add(attr3);
AttributeProcess mockAttributeProcess = mock(AttributeProcess.class);
try {
XmlUtil.iterateAttribute(element, mockAttributeProcess);
verify(mockAttributeProcess).process(attr1);
verify(mockAttributeProcess).process(attr2);
verify(mockAttributeProcess).process(attr3);
} catch (DocumentException e) {
log.error(e.getMessage(), e);
}
}
Aggregations