Methods Summary |
---|
protected void | setUp()
|
protected void | tearDown()
|
public void | testIntersectAllPolicyInCollectionEmptyReturnsEmptyPolicy()
Collection<Policy> policies = new LinkedList<Policy>();
for (int i = 0; i < 10; i++) {
policies.add(Policy.createEmptyPolicy("fake" + i, null));
}
Policy result = intersector.intersect(policies);
assertTrue("Intersecting collection with all policy instances empty should return empty policy as a result", result.isEmpty());
|
public void | testIntersectEmptyPolicyCollectionThrowsIAE()
Collection<Policy> policies = new LinkedList<Policy>();
try {
Policy result = intersector.intersect(policies);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) {
// ok
}
|
public void | testIntersectEmptyPolicyInCollectionReturnsNullPolicy()
Collection<AssertionSet> alternatives = Arrays.asList(new AssertionSet[] {AssertionSet.createAssertionSet(Arrays.asList(new PolicyAssertion[] {new PolicyAssertion(AssertionData.createAssertionData(new QName("A")), null, null){}}))});
Collection<Policy> policies = new LinkedList<Policy>();
for (int i = 0; i < 10; i++) {
policies.add(Policy.createPolicy("fake", null, alternatives));
}
policies.add(Policy.createEmptyPolicy());
Policy result = intersector.intersect(policies);
assertTrue("Intersecting collection with empty policy instance should return null policy as a result", result.isNull());
|
public void | testIntersectNullPolicyCollectionThrowsIAE()
Collection<Policy> policies = null;
try {
Policy result = intersector.intersect(policies);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) {
// ok
}
|
public void | testIntersectNullPolicyInCollectionReturnsNullPolicy()
Collection<AssertionSet> alternatives = Arrays.asList(new AssertionSet[] {AssertionSet.createAssertionSet(Arrays.asList(new PolicyAssertion[] {new PolicyAssertion(AssertionData.createAssertionData(new QName("A")), null, null){}}))});
Collection<Policy> policies = new LinkedList<Policy>();
for (int i = 0; i < 10; i++) {
policies.add(Policy.createPolicy("fake", null, alternatives));
}
policies.add(Policy.createNullPolicy());
Policy result = intersector.intersect(policies);
assertTrue("Intersecting collection with null policy instance should return null policy as a result", result.isNull());
|
public void | testIntersectSimplePolicies()
Collection<Policy> policies = new LinkedList<Policy>();
policies.add(PolicyResourceLoader.loadPolicy("intersection/policy1.xml"));
policies.add(PolicyResourceLoader.loadPolicy("intersection/policy2.xml"));
policies.add(PolicyResourceLoader.loadPolicy("intersection/policy3.xml"));
Policy expectedResult = PolicyResourceLoader.loadPolicy("intersection/intersection_1-2-3.xml");
Policy result = intersector.intersect(policies);
assertEquals("Intersection did not provide expected result.", expectedResult, result);
|
public void | testIntersectSinglePolicyInCollectionReturnsTheSameSinglePolicyInstance()
Collection<Policy> policies = new LinkedList<Policy>();
Policy expected = Policy.createEmptyPolicy("fake", null);
policies.add(expected);
Policy result = intersector.intersect(policies);
assertTrue("Intersecting collection with single policy instance should return the very same policy instance", expected == result);
|
public void | testPolicyIntersectorFactoryMethodDoesNotReturnNull()
assertNotNull(PolicyIntersector.createPolicyIntersector());
|