### Question:
XWikiWikiModel implements WikiModel { @Override public String getDocumentViewURL(ResourceReference resourceReference) { EntityReference documentReference = getDocumentEntityReference(resourceReference); if (documentReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } return this.documentAccessBridge.getDocumentURL(documentReference, "view", resourceReference.getParameter(DocumentResourceReference.QUERY_STRING), resourceReference.getParameter(DocumentResourceReference.ANCHOR)); }  @Override String getLinkURL(ResourceReference linkReference); @Override String getImageURL(ResourceReference imageReference, Map<String, String> parameters); @Override boolean isDocumentAvailable(ResourceReference resourceReference); @Override String getDocumentViewURL(ResourceReference resourceReference); @Override String getDocumentEditURL(ResourceReference resourceReference); @Override XDOM getXDOM(ResourceReference resourceReference);  }### Answer:
@Test void getDocumentViewURLWhenNoBaseReference() { ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); EntityReference documentReference = new DocumentReference("wiki", "space", "page"); when(this.referenceResolver.resolve(reference, EntityType.DOCUMENT)).thenReturn(documentReference); when(this.documentAccessBridge.getDocumentURL(documentReference, "view", null, null)).thenReturn("viewurl"); assertEquals("viewurl", this.wikiModel.getDocumentViewURL(reference)); }
@Test void getDocumentViewURLWhenPage() { ResourceReference reference = new PageResourceReference("page"); PageReference pageReference = new PageReference("wiki", "page"); when(this.referenceResolver.resolve(reference, EntityType.PAGE)).thenReturn(pageReference); when(this.documentAccessBridge.getDocumentURL(pageReference, "view", null, null)).thenReturn("viewurl"); assertEquals("viewurl", this.wikiModel.getDocumentViewURL(reference)); }
@Test void getDocumentViewURLWhenBaseReferenceSpecified() { ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); reference.addBaseReference("base"); EntityReference documentReference = new DocumentReference("wiki", "space", "page"); when(this.referenceResolver.resolve(reference, EntityType.DOCUMENT)).thenReturn(documentReference); when(this.documentAccessBridge.getDocumentURL(documentReference, "view", null, null)).thenReturn("viewurl"); assertEquals("viewurl", this.wikiModel.getDocumentViewURL(reference)); }