@Test
public void testUpdatePolicy() {
EndpointPolicyImpl epi = new TestEndpointPolicy();
Policy p1 = new Policy();
QName aqn1 = new QName("http://x.y.z", "a");
p1.addAssertion(mockAssertion(aqn1, 5, true));
Policy p2 = new Policy();
QName aqn2 = new QName("http://x.y.z", "b");
p2.addAssertion(mockAssertion(aqn2, 5, true));
control.replay();
epi.setPolicy((Policy)p1.normalize(null, true));
Policy ep = epi.updatePolicy(p2).getPolicy();
List<ExactlyOne> pops =
CastUtils.cast(ep.getPolicyComponents(), ExactlyOne.class);
assertEquals("New policy must have 1 top level policy operator", 1, pops.size());
List<All> alts =
CastUtils.cast(pops.get(0).getPolicyComponents(), All.class);
assertEquals("2 alternatives should be available", 2, alts.size());