### Question:
Context extends Api { public void setDisplayMode(String mode) { getXWikiContext().put("display", mode); } Context(XWikiContext context); XWikiRequest getRequest(); XWikiResponse getResponse(); int getMode(); String getDatabase(); String getMainWikiName(); String getOriginalDatabase(); @Programming void setDatabase(String database); XWikiURLFactory getURLFactory(); boolean isMainWiki(); String getAction(); @Deprecated String getLanguage(); Locale getLocale(); @Deprecated String getInterfaceLanguage(); Locale getInterfaceLocale(); @Programming com.xpn.xwiki.XWiki getXWiki(); @Programming XWikiDocument getDoc(); String getUser(); DocumentReference getUserReference(); String getLocalUser(); @Programming void setDoc(XWikiDocument doc); @Programming XWikiContext getContext(); @Programming java.lang.Object get(String key); @Deprecated String getEditorWysiwyg(); @Programming void put(String key, java.lang.Object value); void setFinished(boolean finished); int getCacheDuration(); void setCacheDuration(int duration); void setLinksAction(String action); void unsetLinksAction(); String getLinksAction(); void setLinksQueryString(String value); void unsetLinksQueryString(); String getLinksQueryString(); XWikiValidationStatus getValidationStatus(); List<String> getDisplayedFields(); void setDisplayMode(String mode); java.lang.Object getMacro(); void dropPermissions(); String getMessage();  }### Answer:
@Test public void setDisplayMode() throws Exception { XWikiContext xcontext = this.oldcoreRule.getXWikiContext(); DocumentReference documentReference = new DocumentReference("wiki", "space", "page"); XWikiDocument document = new XWikiDocument(documentReference); BaseClass baseClass = document.getXClass(); doReturn("xwiki/2.1").when(this.oldcoreRule.getSpyXWiki()).getCurrentContentSyntaxId("xwiki/2.1", xcontext); doReturn(baseClass).when(this.oldcoreRule.getSpyXWiki()).getXClass(documentReference, xcontext); baseClass.addTextField("prop", "prop", 5); BaseObject obj = (BaseObject) document.getXClass().newObject(xcontext); obj.setStringValue("prop", "value"); document.addXObject(obj); Context context = new Context(xcontext); context.setDisplayMode("edit"); assertEquals("<input size='5' id='space.page_0_prop' value='value' name='space.page_0_prop' " + "type='text'/>", document.display("prop", xcontext)); }