### Question:
CacheableBatchUpdateOperator extends BatchUpdateOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Set<String> keys = new HashSet<String>(iterables.size() * 2); Map<DataSource, Group> groupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext context = invocationContextFactory.newInvocationContext(new Object[]{obj}); keys.add(driver.getCacheKey(context)); group(context, groupMap, t++); } int[] ints = executeDb(groupMap, t, stat); if (logger.isDebugEnabled()) { logger.debug("Cache delete for multiple keys {}", keys); } driver.batchDeleteFromCache(keys, stat); return transformer.transform(ints); } CacheableBatchUpdateOperator(ASTRootNode rootNode, MethodDescriptor md, CacheDriver cacheDriver, Config config); @Override Object execute(Object[] values, InvocationStat stat);  }### Answer:
@Test public void testBatchUpdate() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<int[]> rt = TypeToken.of(int[].class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql, new CacheHandlerAdapter() { @Override public void batchDelete(Set<String> keys, Class<?> daoClass) { Set<String> set = new HashSet<String>(); set.add("user_100"); set.add("user_200"); assertThat(keys, equalTo(set)); } }, new MockCacheBy("id")); final int[] expectedInts = new int[]{1, 2}; operator.setJdbcOperations(new JdbcOperationsAdapter() { @Override public int[] batchUpdate(DataSource ds, List<BoundSql> boundSqls) throws DataAccessException { String descSql = "update user set name=? where id=?"; assertThat(boundSqls.get(0).getSql(), equalTo(descSql)); assertThat(boundSqls.size(), equalTo(2)); assertThat(boundSqls.get(0).getArgs().get(0), equalTo((Object) "ash")); assertThat(boundSqls.get(0).getArgs().get(1), equalTo((Object) 100)); assertThat(boundSqls.get(1).getArgs().get(0), equalTo((Object) "lucy")); assertThat(boundSqls.get(1).getArgs().get(1), equalTo((Object) 200)); return expectedInts; } }); List<User> users = Arrays.asList(new User(100, "ash"), new User(200, "lucy")); InvocationStat stat = InvocationStat.create(); int[] actualInts = (int[]) operator.execute(new Object[]{users}, stat); assertThat(Arrays.toString(actualInts), equalTo(Arrays.toString(expectedInts))); assertThat(stat.getCacheBatchDeleteSuccessCount(), equalTo(1L)); }