### Question:
XWikiServletURLFactory extends XWikiDefaultURLFactory { @Override public URL getServerURL(XWikiContext context) throws MalformedURLException { return getServerURL(context.getWikiId(), context); } XWikiServletURLFactory();  XWikiServletURLFactory(URL defaultURL, String contextPath, String actionPath);  XWikiServletURLFactory(XWikiContext context); @Override void init(XWikiContext context); void setDefaultURL(String wikiId, URL baseURL); String getContextPath(); @Override URL getServerURL(XWikiContext context); URL getServerURL(String wikiId, XWikiContext context); @Override URL createURL(String spaces, String name, String action, boolean redirect, XWikiContext context); @Override URL createURL(String spaces, String name, String action, String querystring, String anchor, String xwikidb,
        XWikiContext context); @Override URL createExternalURL(String spaces, String name, String action, String querystring, String anchor,
        String xwikidb, XWikiContext context); @Override URL createSkinURL(String filename, String skin, XWikiContext context, Map<String, Object> queryParameters); @Override URL createSkinURL(String filename, String spaces, String name, String xwikidb, XWikiContext context,
        Map<String, Object> queryParameters); @Override URL createResourceURL(String filename, boolean forceSkinAction, XWikiContext context,
        Map<String, Object> queryParameters); URL createTemplateURL(String fileName, XWikiContext context); @Override URL createAttachmentURL(String filename, String spaces, String name, String action, String querystring,
        String xwikidb, XWikiContext context); @Override URL createAttachmentRevisionURL(String filename, String spaces, String name, String revision,
        String querystring, String xwikidb, XWikiContext context); URL createAttachmentRevisionURL(String filename, String spaces, String name, String revision, long recycleId,
        String querystring, String xwikidb, XWikiContext context); @Override String getURL(URL url, XWikiContext context); @Override URL getRequestURL(XWikiContext context); XWikiAttachment findAttachmentForDocRevision(XWikiDocument doc, String docRevision, String filename,
        XWikiContext context); long findDeletedAttachmentForDocRevision(XWikiDocument doc, String docRevision, String filename,
        XWikiContext context);  }### Answer:
@Test public void getServerURLFromSubWikiWithXWikiDotHomeEnabled() throws MalformedURLException { this.oldcore.getXWikiContext().setOriginalWikiId("subwiki"); this.oldcore.getMockXWikiCfg().setProperty("xwiki.home", "http: this.oldcore.getXWikiContext().setWikiId("subwiki"); initRequest("virtual1.mywiki.tld", -1); assertEquals("http: urlFactory.getServerURL("xwiki", this.oldcore.getXWikiContext()).toString()); }
@Test public void getServerURLWithXWikiDotHomeEnabled() throws MalformedURLException { this.oldcore.getMockXWikiCfg().setProperty("xwiki.home", "http: initRequest("localhost", 8080); assertEquals("http: urlFactory.getServerURL("xwiki", this.oldcore.getXWikiContext()).toString()); assertEquals("http: urlFactory.getServerURL(null, this.oldcore.getXWikiContext()).toString()); }