### Question:
AssertionInfoMap extends HashMap<QName, Collection<AssertionInfo>> { public void check() { for (Collection<AssertionInfo> ais : values()) { for (AssertionInfo ai : ais) { if (!ai.isAsserted()) { throw new PolicyException(new org.apache.cxf.common.i18n.Message( "NOT_ASSERTED_EXC", BUNDLE, ai.getAssertion().getName())); } } } } AssertionInfoMap(Policy p);  AssertionInfoMap(Collection<? extends Assertion> assertions); Collection<AssertionInfo> getAssertionInfo(QName name); boolean supportsAlternative(PolicyComponent assertion,
                                       List<QName> errors); boolean supportsAlternative(Collection<? extends PolicyComponent> alternative,
                                       List<QName> errors); List<List<Assertion>> checkEffectivePolicy(Policy policy); void check();  }### Answer:
@Test public void testCheck() throws PolicyException { QName aqn = new QName("http: Assertion a = new PrimitiveAssertion(aqn); Collection<Assertion> assertions = new ArrayList<>(); assertions.add(a); AssertionInfoMap aim = new AssertionInfoMap(assertions); try { aim.check(); fail("Expected PolicyException not thrown."); } catch (PolicyException ex) { assertEquals("NOT_ASSERTED_EXC", ex.getCode()); } aim.get(aqn).iterator().next().setAsserted(true); aim.check(); }
@Test public void testCheck() throws PolicyException { QName aqn = new QName("http: Assertion a = new PrimitiveAssertion(aqn); Collection<Assertion> assertions = new ArrayList<Assertion>(); assertions.add(a); AssertionInfoMap aim = new AssertionInfoMap(assertions); try { aim.check(); fail("Expected PolicyException not thrown."); } catch (PolicyException ex) { assertEquals("NOT_ASSERTED_EXC", ex.getCode()); } aim.get(aqn).iterator().next().setAsserted(true); aim.check(); }