### Question:
EffectivePolicyImpl implements EffectivePolicy { void chooseAlternative(PolicyEngine engine, Assertor assertor, Message m) { chooseAlternative(engine, assertor, null, m); } EffectivePolicyImpl(); Policy getPolicy(); List<Interceptor<? extends org.apache.cxf.message.Message>> getInterceptors(); Collection<Assertion> getChosenAlternative(); void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, Message m); void initialise(EndpointPolicy epi, PolicyEngine engine, boolean inbound, boolean fault, Message m); void initialise(EndpointInfo ei,
                    BindingOperationInfo boi,
                    PolicyEngine engine,
                    Assertor assertor,
                    boolean requestor,
                    boolean request,
                    Message m); void initialise(EndpointInfo ei,
                    BindingOperationInfo boi,
                    PolicyEngine engine,
                    Assertor assertor,
                    List<List<Assertion>> incoming,
                    Message m); void initialise(EndpointInfo ei,
                    BindingOperationInfo boi,
                    PolicyEngine engine,
                    boolean requestor, boolean request,
                    Message m); void initialise(EndpointInfo ei,
                    BindingOperationInfo boi,
                    BindingFaultInfo bfi,
                    PolicyEngine engine,
                    Assertor assertor,
                    Message m);  }### Answer:
@Test public void testChooseAlternative() { Message m = new MessageImpl(); EffectivePolicyImpl epi = new EffectivePolicyImpl(); Policy policy = new Policy(); epi.setPolicy(policy); PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class); Assertor assertor = control.createMock(Assertor.class); AlternativeSelector selector = control.createMock(AlternativeSelector.class); EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector); EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(null); control.replay(); try { epi.chooseAlternative(engine, assertor, m); fail("Expected PolicyException not thrown."); } catch (PolicyException ex) { } control.verify(); control.reset(); EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector); Collection<Assertion> alternative = new ArrayList<>(); EasyMock.expect(selector.selectAlternative(policy, engine, assertor, null, m)).andReturn(alternative); control.replay(); epi.chooseAlternative(engine, assertor, m); Collection<Assertion> choice = epi.getChosenAlternative(); assertSame(choice, alternative); control.verify(); }