### Question:
InvocationInterceptorChain { public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int i = 0; i < parameterValues.size(); i++) { ParameterDescriptor pd = parameterDescriptors.get(i); parameters.add(new Parameter(pd, parameterValues.get(i))); } interceptorChain.intercept(boundSql, parameters, sqlType, dataSource); } } InvocationInterceptorChain(InterceptorChain interceptorChain,
                                    List<ParameterDescriptor> parameterDescriptors,
                                    SQLType sqlType); void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource);  }### Answer:
@Test public void testIntercept() throws Exception { final String sql = "select * from user where id=? and name=?"; BoundSql boundSql = new BoundSql(sql); boundSql.addArg(1); boundSql.addArg("ash"); final User user = new User(); user.setId(100); user.setName("lucy"); InterceptorChain ic = new InterceptorChain(); ic.addInterceptor(new Interceptor() { @Override public void intercept(BoundSql boundSql, List<Parameter> parameters, SQLType sqlType, DataSource dataSource) { assertThat(boundSql.getSql(), equalTo(sql)); assertThat(boundSql.getArgs(), equalTo(boundSql.getArgs())); assertThat(boundSql.getTypeHandlers(), equalTo(boundSql.getTypeHandlers())); assertThat((User) parameters.get(0).getValue(), equalTo(user)); assertThat(sqlType, equalTo(SQLType.SELECT)); } }); List<Annotation> empty = Collections.emptyList(); TypeToken<User> t = new TypeToken<User>() { }; ParameterDescriptor p = ParameterDescriptor.create(0, t.getType(), empty, "1"); List<ParameterDescriptor> pds = Arrays.asList(p); InvocationInterceptorChain iic = new InvocationInterceptorChain(ic, pds, SQLType.SELECT); InvocationContextFactory f = InvocationContextFactory.create(DefaultParameterContext.create(pds)); InvocationContext ctx = f.newInvocationContext(new Object[]{user}); iic.intercept(boundSql, ctx, null); }