/** Test that the store code is resolved and cached by <code>resolveStoreCodeHeader</code>. */ @Test public void testResolveStoreCodeSessionIsCached() { final String storeCode = "store5"; MockHttpSession session = new MockHttpSession(); session.setAttribute(STORE_CODE, storeCode); request.setSession(session); context.checking( new Expectations() { { oneOf(delegate).resolveStoreCodeSession(request, STORE_CODE); will(returnValue(storeCode)); } }); assertEquals( SAME_CODE_AS_DELEGATE_EXPECTED, storeCode, cachingResolver.resolveStoreCodeSession(request, STORE_CODE)); assertEquals( SAME_CODE_EXPECTED_ON_SECOND_CALL, storeCode, cachingResolver.resolveStoreCodeSession(request, STORE_CODE)); }