### Question:
XWikiContext extends Hashtable<Object, Object> { @Deprecated public void setUser(String user) { setUserInternal(user, false); } XWikiContext(); XWiki getWiki(); Util getUtil(); void setWiki(XWiki wiki); XWikiEngineContext getEngineContext(); void setEngineContext(XWikiEngineContext engine_context); XWikiRequest getRequest(); void setRequest(XWikiRequest request); String getAction(); void setAction(String action); XWikiResponse getResponse(); void setResponse(XWikiResponse response); @Deprecated String getDatabase(); String getWikiId(); WikiReference getWikiReference(); @Deprecated void setDatabase(String wikiId); void setWikiId(String wikiId); void setWikiReference(WikiReference wikiReference); @Override synchronized Object get(Object key); @Override synchronized Object put(Object key, Object value); @Override synchronized Object remove(Object key); @Deprecated String getOriginalDatabase(); String getOriginalWikiId(); @Deprecated void setOriginalDatabase(String wikiId); void setOriginalWikiId(String wikiId); boolean isMainWiki(); boolean isMainWiki(String wikiName); XWikiDocument getDoc(); void setDoc(XWikiDocument doc); DocumentReference getUserReference(); void setUserReference(DocumentReference userReference); @Deprecated void setUser(String user); @Deprecated String getUser(); @Deprecated String getLocalUser(); @Deprecated XWikiUser getXWikiUser(); @Deprecated String getLanguage(); @Deprecated void setLanguage(String language); Locale getLocale(); void setLocale(Locale locale); @Deprecated String getInterfaceLanguage(); Locale getInterfaceLocale(); void setInterfaceLocale(Locale interfaceLocale); int getMode(); void setMode(int mode); URL getURL(); void setURL(URL url); XWikiURLFactory getURLFactory(); void setURLFactory(XWikiURLFactory URLFactory); XWikiForm getForm(); void setForm(XWikiForm form); boolean isFinished(); void setFinished(boolean finished); XWikiDocument getWikiServer(); int getCacheDuration(); void setCacheDuration(int cacheDuration); String getMainXWiki(); void setMainXWiki(String str); void addBaseClass(BaseClass bclass); BaseClass getBaseClass(DocumentReference classReference); void removeBaseClass(DocumentReference classReference); void flushClassCache(); void setLinksAction(String action); void unsetLinksAction(); String getLinksAction(); void setLinksQueryString(String value); void unsetLinksQueryString(); String getLinksQueryString(); @Deprecated XWikiMessageTool getMessageTool(); XWikiValidationStatus getValidationStatus(); void setValidationStatus(XWikiValidationStatus status); void addDisplayedField(String fieldname); List<String> getDisplayedFields(); @Deprecated String getEditorWysiwyg(); void dropPermissions(); boolean hasDroppedPermissions(); @Override synchronized XWikiContext clone(); void declareInExecutionContext(ExecutionContext executionContext); DocumentReference getAuthorReference(); static final ParameterizedType TYPE_PROVIDER; static final int MODE_SERVLET; static final int MODE_PORTLET; static final int MODE_XMLRPC; static final int MODE_ATOM; static final int MODE_PDF; static final int MODE_GWT; static final int MODE_GWT_DEBUG; static final String EXECUTIONCONTEXT_KEY; @Deprecated
    static final String KEY_LEGACY_VELOCITYCONTEXT; }### Answer:
@Test public void testSetUser() { this.xcontext.setMainXWiki("wiki"); this.xcontext.setWikiId("wiki"); this.xcontext.setUser("XWiki.user"); assertEquals(new DocumentReference("wiki", "XWiki", "user"), this.xcontext.getUserReference()); assertEquals("XWiki.user", this.xcontext.getUser()); this.xcontext.setUser("user"); assertEquals(new DocumentReference("wiki", "XWiki", "user"), this.xcontext.getUserReference()); assertEquals("XWiki.user", this.xcontext.getUser()); }