@Test
public void testPreHandleValidTokenOnCheck() throws Exception {

    HttpSessionTransactionTokenStore tokenStore = new HttpSessionTransactionTokenStore();
    TransactionToken inputToken = new TransactionToken("testTokenAttr", "111", "222");
    tokenStore.store(inputToken);
    assertThat(tokenStore.getSession().getAttribute(tokenStore
            .createSessionAttributeName(inputToken)), is(notNullValue()));
    request.setParameter(
            TransactionTokenInterceptor.TOKEN_REQUEST_PARAMETER,
            "testTokenAttr~111~222");
    interceptor = new TransactionTokenInterceptor(new TokenStringGenerator(), new TransactionTokenInfoStore(), tokenStore);
    boolean result = interceptor.preHandle(request, response,
            new HandlerMethod(new TransactionTokenSampleController(), TransactionTokenSampleController.class
                    .getDeclaredMethod("fifth", SampleForm.class,
                            Model.class)));
    assertThat(result, is(true));
    TransactionTokenContext transactionTokenCtx = (TransactionTokenContext) request
            .getAttribute(
                    TransactionTokenInterceptor.TOKEN_CONTEXT_REQUEST_ATTRIBUTE_NAME);
    TransactionToken token = transactionTokenCtx.getReceivedToken();
    assertThat(token, is(notNullValue()));
    assertThat(token.getTokenName(), is("testTokenAttr"));
    assertThat(token.getTokenKey(), is("111"));
    assertThat(token.getTokenValue(), is("222"));
}