@Test public void testBuildComponent() throws Exception { BaseObject baseObject = mock(BaseObject.class); XWikiDocument parentDocument = mock(XWikiDocument.class); DocumentReference documentReference = mock(DocumentReference.class); when(baseObject.getOwnerDocument()).thenReturn(parentDocument); when(parentDocument.getDocumentReference()).thenReturn(documentReference); when(this.authorizationManager.hasAccess(any(), any(), any())).thenReturn(true); List<WikiComponent> result = this.mocker.getComponentUnderTest().buildComponents(baseObject); assertEquals(1, result.size()); }
@Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { XWikiDocument parentDocument = baseObject.getOwnerDocument(); this.checkRights(parentDocument.getDocumentReference(), parentDocument.getAuthorReference()); return Arrays.asList( new DefaultUntypedRecordableEventDescriptor( baseObject.getReference(), parentDocument.getAuthorReference(), baseObject, contextualLocalizationManager, namespaceContextExecutor)); } catch (Exception e) { throw new WikiComponentException(String.format( "Unable to build the UntypedRecordableEvent wiki component " + "for [%s].", baseObject), e); } }
UntypedRecordableEventDescriptorComponentBuilder implements WikiBaseObjectComponentBuilder { @Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { XWikiDocument parentDocument = baseObject.getOwnerDocument(); this.checkRights(parentDocument.getDocumentReference(), parentDocument.getAuthorReference()); return Arrays.asList( new DefaultUntypedRecordableEventDescriptor( baseObject.getReference(), parentDocument.getAuthorReference(), baseObject, contextualLocalizationManager, namespaceContextExecutor)); } catch (Exception e) { throw new WikiComponentException(String.format( "Unable to build the UntypedRecordableEvent wiki component " + "for [%s].", baseObject), e); } } }
UntypedRecordableEventDescriptorComponentBuilder implements WikiBaseObjectComponentBuilder { @Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { XWikiDocument parentDocument = baseObject.getOwnerDocument(); this.checkRights(parentDocument.getDocumentReference(), parentDocument.getAuthorReference()); return Arrays.asList( new DefaultUntypedRecordableEventDescriptor( baseObject.getReference(), parentDocument.getAuthorReference(), baseObject, contextualLocalizationManager, namespaceContextExecutor)); } catch (Exception e) { throw new WikiComponentException(String.format( "Unable to build the UntypedRecordableEvent wiki component " + "for [%s].", baseObject), e); } }  }
UntypedRecordableEventDescriptorComponentBuilder implements WikiBaseObjectComponentBuilder { @Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { XWikiDocument parentDocument = baseObject.getOwnerDocument(); this.checkRights(parentDocument.getDocumentReference(), parentDocument.getAuthorReference()); return Arrays.asList( new DefaultUntypedRecordableEventDescriptor( baseObject.getReference(), parentDocument.getAuthorReference(), baseObject, contextualLocalizationManager, namespaceContextExecutor)); } catch (Exception e) { throw new WikiComponentException(String.format( "Unable to build the UntypedRecordableEvent wiki component " + "for [%s].", baseObject), e); } }  @Override EntityReference getClassReference(); @Override List<WikiComponent> buildComponents(BaseObject baseObject); }
UntypedRecordableEventDescriptorComponentBuilder implements WikiBaseObjectComponentBuilder { @Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { XWikiDocument parentDocument = baseObject.getOwnerDocument(); this.checkRights(parentDocument.getDocumentReference(), parentDocument.getAuthorReference()); return Arrays.asList( new DefaultUntypedRecordableEventDescriptor( baseObject.getReference(), parentDocument.getAuthorReference(), baseObject, contextualLocalizationManager, namespaceContextExecutor)); } catch (Exception e) { throw new WikiComponentException(String.format( "Unable to build the UntypedRecordableEvent wiki component " + "for [%s].", baseObject), e); } }  @Override EntityReference getClassReference(); @Override List<WikiComponent> buildComponents(BaseObject baseObject); static final String BOUNDED_XOBJECT_CLASS; }