@Test
public void testPreHandleTokenIsSentInHiddenFieldAtBeginPhase() throws Exception {

    HttpSessionTransactionTokenStore tokenStore = new HttpSessionTransactionTokenStore();
    TransactionToken inputToken = new TransactionToken("tokenName1", "111", "222");
    tokenStore.store(inputToken);
    assertThat(tokenStore.getSession().getAttribute(tokenStore
            .createSessionAttributeName(inputToken)), is(notNullValue()));
    request.setParameter(
            TransactionTokenInterceptor.TOKEN_REQUEST_PARAMETER,
            "tokenName1~111~222");
    interceptor = new TransactionTokenInterceptor(new TokenStringGenerator(), new TransactionTokenInfoStore(), tokenStore);
    interceptor.preHandle(request, response,
            new HandlerMethod(new TransactionTokenSampleController(), TransactionTokenSampleController.class
                    .getDeclaredMethod("first", SampleForm.class,
                            Model.class)));
    // check if inputToken is removed
    assertThat(tokenStore.getSession().getAttribute(tokenStore
            .createSessionAttributeName(inputToken)), is(nullValue()));
}