### Question:
EndpointPolicyImpl implements EndpointPolicy { void initializePolicy(Message m) { if (engine != null) { policy = engine.getAggregatedServicePolicy(ei.getService(), m); policy = policy.merge(engine.getAggregatedEndpointPolicy(ei, m)); if (!policy.isEmpty()) { policy = policy.normalize(engine.getRegistry(), true); } } } EndpointPolicyImpl();  EndpointPolicyImpl(Policy p);  EndpointPolicyImpl(EndpointInfo ei,
                              PolicyEngineImpl engine,
                              boolean requestor,
                              Assertor assertor); Policy getPolicy(); Assertor getAssertor(); EndpointPolicy updatePolicy(Policy p, Message msg); Collection<Assertion> getChosenAlternative(); Collection<Assertion> getVocabulary(Message m); Collection<Assertion> getFaultVocabulary(Message m); List<Interceptor<? extends Message>> getInterceptors(Message m); List<Interceptor<? extends Message>> getFaultInterceptors(Message m); void initialize(Message m);  }### Answer:
@Test public void testInitializePolicy() { EndpointInfo ei = control.createMock(EndpointInfo.class); PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class); ServiceInfo si = control.createMock(ServiceInfo.class); EasyMock.expect(ei.getService()).andReturn(si); Policy sp = control.createMock(Policy.class); EasyMock.expect(engine.getAggregatedServicePolicy(si, null)).andReturn(sp); Policy ep = control.createMock(Policy.class); EasyMock.expect(engine.getAggregatedEndpointPolicy(ei, null)).andReturn(ep); Policy merged = control.createMock(Policy.class); EasyMock.expect(sp.merge(ep)).andReturn(merged); EasyMock.expect(merged.normalize(null, true)).andReturn(merged); control.replay(); EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, true, null); epi.initializePolicy(null); assertSame(merged, epi.getPolicy()); control.verify(); }