### Question:
ModeUtil { public static boolean isTouch(SlingHttpServletRequest request) { return AuthoringUIMode.TOUCH == AuthoringUIMode.fromRequest(request); }  static WCMMode getMode(SlingHttpServletRequest req); static boolean isAuthor(); static boolean isPublish(); static boolean isRunmode(String mode); static boolean isAnalytics(SlingHttpServletRequest request); static boolean isDesign(SlingHttpServletRequest request); static boolean isDisabled(SlingHttpServletRequest request); static boolean isEdit(SlingHttpServletRequest request); static boolean isPreview(SlingHttpServletRequest request); static boolean isReadOnly(SlingHttpServletRequest request); static boolean isClassic(SlingHttpServletRequest request); static boolean isTouch(SlingHttpServletRequest request); static synchronized void configure(SlingSettingsService slingSettings);  }### Answer:
@Test public void testIsTouch() { when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.TOUCH); assertTrue(ModeUtil.isTouch(request)); verify(request, atLeast(1)).getAttribute(AuthoringUIMode.class.getName()); verifyNoMoreInteractions(request); }
@Test public void testIsNotTouch() { when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.CLASSIC); assertFalse(ModeUtil.isTouch(request)); verify(request, atLeast(1)).getAttribute(AuthoringUIMode.class.getName()); verifyNoMoreInteractions(request); }