use of org.xwiki.model.reference.AttachmentReferenceResolver in project xwiki-platform by xwiki.
the class IntegrationTests method initialize.
@RenderingTestSuite.Initialized
public void initialize(ComponentManager componentManager) throws Exception {
Mockery mockery = new JUnit4Mockery();
// Attachment Reference Resolver Mock
final AttachmentReferenceResolver<String> mockResolver = mockery.mock(AttachmentReferenceResolver.class);
mockery.checking(new Expectations() {
{
allowing(mockResolver).resolve("Space.ExistingPage@my.png");
will(returnValue(new AttachmentReference("my.png", new DocumentReference("wiki", "Space", "ExistingPage"))));
}
});
DefaultComponentDescriptor<AttachmentReferenceResolver<String>> descriptorARS = new DefaultComponentDescriptor<AttachmentReferenceResolver<String>>();
descriptorARS.setRoleType(AttachmentReferenceResolver.TYPE_STRING);
descriptorARS.setRoleHint("current");
componentManager.registerComponent(descriptorARS, mockResolver);
// WikiModel Mock
componentManager.registerComponent(MockWikiModel.getComponentDescriptor());
}
Aggregations