XacmlPolicyListFilter { public boolean containsInValue(NodeList nodeList, String value) { for (int i = 0; i < nodeList.getLength(); i++) { String nodeValue = nodeList.item(i).getNodeValue(); if (value.equals(nodeValue)) { return true; } } return false; } XacmlPolicyListFilter(DocumentXmlConverter documentXmlConverter,
			DocumentAccessor documentAccessor); void filterByNPI(List<String> policies, String recipientSubjectNPI,
			String intermediarySubjectNPI); boolean containsInValue(NodeList nodeList, String value); static final String URN_XACML_1_INTERMEDIARY_SUBJECT; static final String URN_XACML_1_RECIPIENT_SUBJECT; static final String XPATH_CONDITION_ATTRIBUTE_VALUE; }
@Test public void testContainsInValue() { Node node = mock(Node.class); when(node.getNodeValue()).thenReturn("value"); NodeList nodeList = mock(NodeList.class); when(nodeList.getLength()).thenReturn(1).thenReturn(1); when(nodeList.item(0)).thenReturn(node).thenReturn(node); boolean test1 = sut.containsInValue(nodeList, "value"); boolean test2 = sut.containsInValue(nodeList, "not_value"); assertTrue(test1); assertFalse(test2); }