### Question:
WCMModeFunctions { public static boolean isEdit(PageContext pageContext) { if (pageContext == null) { return false; } final ServletRequest request = pageContext.getRequest(); if (request == null) { return false; } return WCMMode.fromRequest(request) == WCMMode.EDIT; } private  WCMModeFunctions(); static boolean isDesign(PageContext pageContext); static boolean isDisabled(PageContext pageContext); static boolean isEdit(PageContext pageContext); static boolean isPreview(PageContext pageContext);  }### Answer:
@Test public void testIsEdit() { assertFalse(WCMModeFunctions.isEdit(null)); assertFalse(WCMModeFunctions.isEdit(pageContext)); when(pageContext.getRequest()).thenReturn(request); assertFalse(WCMModeFunctions.isEdit(pageContext)); when(request.getAttribute(WCMMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(WCMMode.EDIT); assertTrue(WCMModeFunctions.isEdit(pageContext)); when(request.getAttribute(WCMMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(WCMMode.DISABLED); assertFalse(WCMModeFunctions.isEdit(pageContext)); }