### Question:
LiteDeviceDelegatingViewResolver extends AbstractDeviceDelegatingViewResolver { public void setTabletSuffix(String tabletSuffix) { this.tabletSuffix = (tabletSuffix != null ? tabletSuffix : ""); } LiteDeviceDelegatingViewResolver(ViewResolver delegate); void setNormalPrefix(String normalPrefix); void setMobilePrefix(String mobilePrefix); void setTabletPrefix(String tabletPrefix); void setNormalSuffix(String normalSuffix); void setMobileSuffix(String mobileSuffix); void setTabletSuffix(String tabletSuffix);  }### Answer:
@Test public void resolveViewNameTabletDeviceTabletSuffixRedirect() throws Exception { this.viewName = "redirect:about"; device.setDeviceType(DeviceType.TABLET); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); viewResolver.setTabletSuffix(".tab"); replayMocks("redirect:about"); }
@Test public void resolveViewNameTabletDeviceSuffixFallback() throws Exception { device.setDeviceType(DeviceType.TABLET); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); viewResolver.setTabletSuffix(".tab"); viewResolver.setEnableFallback(true); expect(delegateViewResolver.resolveViewName(viewName + ".tab", locale)).andReturn(null); expect(delegateViewResolver.resolveViewName(viewName, locale)).andReturn(view); replay(delegateViewResolver, view); View result = viewResolver.resolveViewName(viewName, locale); assertSame("Invalid view", view, result); verify(delegateViewResolver, view); }
@Test public void resolveViewNameNormalDeviceTabletSitePreferenceTabletSuffix() throws Exception { device.setDeviceType(DeviceType.NORMAL); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET); viewResolver.setTabletSuffix(".tab"); replayMocks(viewName + ".tab"); }
@Test public void resolveViewNameMobileDeviceTabletSitePreferenceTabletSuffix() throws Exception { device.setDeviceType(DeviceType.MOBILE); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET); viewResolver.setTabletSuffix(".tab"); replayMocks(viewName + ".tab"); }
@Test public void resolveViewNameTabletDeviceNoSitePreferenceTabletSuffix() throws Exception { device.setDeviceType(DeviceType.TABLET); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); viewResolver.setTabletSuffix(".tab"); replayMocks(viewName + ".tab"); }
@Test public void resolveViewNameTabletDeviceTabletSitePreferenceTabletSuffix() throws Exception { device.setDeviceType(DeviceType.TABLET); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET); viewResolver.setTabletSuffix(".tab"); replayMocks(viewName + ".tab"); }