/** Test that the store code is resolved and cached by <code>resolveStoreCodeHeader</code>. */ @Test public void testResolveDomainSessionIsCached() { final String domain = "domain"; MockHttpSession session = new MockHttpSession(); session.setAttribute(domain, "http://www.store6.com"); request.setSession(session); context.checking( new Expectations() { { oneOf(delegate).resolveDomainSession(request, STORE_CODE); will(returnValue("store6")); } }); assertEquals( SAME_CODE_AS_DELEGATE_EXPECTED, "store6", cachingResolver.resolveDomainSession(request, STORE_CODE)); assertEquals( SAME_CODE_EXPECTED_ON_SECOND_CALL, "store6", cachingResolver.resolveDomainSession(request, STORE_CODE)); }