private void setUpResolveDeviceClassMock(boolean hasResolverScript, boolean timeStampChanged) { if (timeStampChanged && hasResolverScript) { expect( deviceClassResolverServiceMock.resolveValue( isA(ResolverContext.class), isA(ResourceFile.class))) .andReturn(createScriptResolverReturnValue(RESOLVED_DEVICE_NAME)) .times(1); } }
@Test public void testDefaultDeviceClass() { setUpGetResourceFileMock(true, true); expect( deviceClassResolverServiceMock.resolveValue( isA(ResolverContext.class), isA(ResourceFile.class))) .andReturn(createScriptResolverReturnValue("")) .times(1); replay(deviceClassResolverServiceMock); SiteEntity site = createSite(true); ResolverContext context = new ResolverContext(request, site); String deviceClass = deviceClassResolverService.getDeviceClass(context); assertEquals(DeviceClassResolverServiceImpl.DEFAULT_DEVICE_CLASS, deviceClass); }