[java-identity-provider COMMIT] /trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering...
noreply at shibboleth.net
noreply at shibboleth.net
Thu May 23 02:35:06 EDT 2013
Author: rdw
Date: Thu May 23 02:35:05 2013
New Revision: 4483
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4483&view=rev
Log:
A a regression test for the bug found and fixed in r4482
Modified:
trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcherTest.java
Modified: trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcherTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcherTest.java?rev=4483&r1=4482&r2=4483&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcherTest.java (original)
+++ trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filtering/impl/matcher/logic/OrMatcherTest.java Thu May 23 02:35:05 2013
@@ -25,6 +25,7 @@
import java.util.Set;
import net.shibboleth.idp.attribute.AttributeValue;
+import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.filtering.AttributeFilteringException;
import net.shibboleth.idp.attribute.filtering.MatchFunctor;
import net.shibboleth.idp.attribute.filtering.impl.matcher.AbstractMatcherTest;
@@ -40,6 +41,8 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
/** {@link OrMatcher} unit test. */
@@ -96,7 +99,7 @@
Set<AttributeValue> result = matcher.getMatchingValues(attribute, filterContext);
Assert.assertNotNull(result);
Assert.assertEquals(result.size(), 2);
- Assert.assertTrue(result.contains(value2) && result.contains(value2));
+ Assert.assertTrue(result.contains(value2) && result.contains(value1));
matcher.destroy();
try {
@@ -110,6 +113,25 @@
matcher.setId("test");
matcher.initialize();
Assert.assertTrue(matcher.getMatchingValues(attribute, filterContext).isEmpty());
+ }
+
+ @Test public void testRegressionGetValues() throws ComponentInitializationException, AttributeFilteringException {
+ OrMatcher matcher =
+ new OrMatcher(Lists.<MatchFunctor> newArrayList(
+ new MockValuePredicateMatcher(Predicates.alwaysFalse()),
+ new MockValuePredicateMatcher(Predicates.alwaysFalse()),
+ new MockValuePredicateMatcher(equalTo(value1)),
+ new MockValuePredicateMatcher(equalTo(value2))));
+ matcher.setId("Test");
+ matcher.initialize();
+
+ Set<AttributeValue> result = matcher.getMatchingValues(attribute, filterContext);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(result.size(), 2);
+ Assert.assertTrue(result.contains(value2) && result.contains(value1));
+
+ matcher.destroy();
+
}
@Test public void testNoMatchingValues() throws Exception {
More information about the commits
mailing list