### Question:
XWikiWikiModel implements WikiModel { @Override public String getDocumentEditURL(ResourceReference resourceReference) { String modifiedQueryString = resourceReference.getParameter(DocumentResourceReference.QUERY_STRING); if (StringUtils.isBlank(modifiedQueryString)) { DocumentReference reference = this.documentAccessBridge.getCurrentDocumentReference(); if (reference != null) { try { modifiedQueryString = "parent=" + URLEncoder.encode(this.compactEntityReferenceSerializer.serialize(reference), UTF8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to URL encode [" + reference + "] using UTF-8.", e); } } } EntityReference documentReference = getDocumentEntityReference(resourceReference); if (documentReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } return this.documentAccessBridge.getDocumentURL(documentReference, "create", modifiedQueryString, 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 getDocumentEditURLWhenNoQueryStringSpecified() { DocumentResourceReference reference = new DocumentResourceReference("TargetSpace.TargetPage"); reference.setAnchor("anchor"); DocumentReference currentDocumentReference = new DocumentReference("Wiki", "Space", "Page\u20AC"); EntityReference documentReference = new DocumentReference("TargetWiki", "TargetSpace", "TargetPage"); when(this.documentAccessBridge.getCurrentDocumentReference()).thenReturn(currentDocumentReference); when(compactEntityReferenceSerializer.serialize(currentDocumentReference)).thenReturn("Wiki:Space.Page\u20AC"); when(this.referenceResolver.resolve(reference, EntityType.DOCUMENT)).thenReturn(documentReference); this.wikiModel.getDocumentEditURL(reference); verify(this.documentAccessBridge).getDocumentURL(documentReference, "create", "parent=Wiki%3ASpace.Page%E2%82%AC", "anchor"); }