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)).andReturn(sp);
Policy ep = control.createMock(Policy.class);
EasyMock.expect(engine.getAggregatedEndpointPolicy(ei)).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();
assertSame(merged, epi.getPolicy());