use of org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitAttributeConditionalSubstitutionNode.
@Test
public void testVisitAttributeConditionalSubstitutionNode() throws IOException, XMLStreamException {
String attributeName = "attributeName";
String attributeValue = "attributeValue";
VariantTypeNode sub = mock(VariantTypeNode.class);
when(sub.getValue()).thenReturn(attributeValue);
substitutions.add(sub);
AttributeNode attributeNode = mock(AttributeNode.class);
ConditionalSubstitutionNode conditionalSubstitutionNode = mock(ConditionalSubstitutionNode.class);
when(attributeNode.getAttributeName()).thenReturn(attributeName);
when(attributeNode.getValue()).thenReturn(conditionalSubstitutionNode);
doAnswer(invocation -> {
((BxmlNodeVisitor) invocation.getArguments()[0]).visit(conditionalSubstitutionNode);
return null;
}).when(conditionalSubstitutionNode).accept(any(BxmlNodeVisitor.class));
when(conditionalSubstitutionNode.getIndex()).thenReturn(0);
xmlBxmlNodeVisitor.visit(attributeNode);
verify(xmlStreamWriter).writeAttribute(attributeName, attributeValue);
}
Aggregations