}
@Test
public void testLocalServiceModelReferenceResolver() {
DescriptionInfo di = control.createMock(DescriptionInfo.class);
PolicyBuilder builder = control.createMock(PolicyBuilder.class);
LocalServiceModelReferenceResolver resolver =
new LocalServiceModelReferenceResolver(di, builder);
List<UnknownExtensibilityElement> extensions = new ArrayList<UnknownExtensibilityElement>();
EasyMock.expect(di.getExtensors(UnknownExtensibilityElement.class)).andReturn(extensions);
control.replay();
assertNull(resolver.resolveReference("A"));
control.verify();
control.reset();
UnknownExtensibilityElement extension = control.createMock(UnknownExtensibilityElement.class);
extensions.add(extension);
EasyMock.expect(di.getExtensors(UnknownExtensibilityElement.class)).andReturn(extensions);
Element e = control.createMock(Element.class);
EasyMock.expect(extension.getElement()).andReturn(e).times(2);
QName qn = new QName(Constants.URI_POLICY_NS,
Constants.ELEM_POLICY);
EasyMock.expect(extension.getElementType()).andReturn(qn).anyTimes();
EasyMock.expect(e.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
PolicyConstants.WSU_ID_ATTR_NAME))
.andReturn("A");
Policy p = control.createMock(Policy.class);
EasyMock.expect(builder.getPolicy(e)).andReturn(p);
control.replay();
assertSame(p, resolver.resolveReference("A"));
control.verify();