@Test
public void testPreHandleWithTokenValidate() throws Exception {

    HttpSessionTransactionTokenStore tokenStore = new HttpSessionTransactionTokenStore();
    TransactionToken inputToken = new TransactionToken("testTokenAttr", "111", "222");
    tokenStore.store(inputToken);
    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("third", SampleForm.class,
                            Model.class)));
    // Confirm return value
    assertThat(result, is(true));
    // Confirm that TokenContext is stored in the request
    assertThat(request.getAttribute(
            TransactionTokenInterceptor.TOKEN_CONTEXT_REQUEST_ATTRIBUTE_NAME),
            is(notNullValue()));
}