@Test
public void testSingleThreadWithElementRemove() throws Exception {

    final AtomicBoolean stop = new AtomicBoolean(false);
    Future<Map<Integer, Integer>> future = threadPool.submit(new Callable<Map<Integer, Integer>>() {
        @Override
        public Map<Integer, Integer> call() throws Exception {
            TestWorker worker = new TestWorker();
            while (!stop.get()) {
                worker.process();
            }
            return worker.map;
        }
    });
    Thread.sleep(200);
    List<Integer> newList = new ArrayList<Integer>();
    newList.addAll(iList);
    final List<Integer> removedElements = new ArrayList<Integer>();
    removedElements.add(newList.remove(2));
    removedElements.add(newList.remove(5));
    removedElements.add(newList.remove(6));
    cList.swapWithList(newList);
    Thread.sleep(200);
    stop.set(true);
    Map<Integer, Integer> result = future.get();
    Map<Integer, Integer> subMap = CollectionUtils.filterKeys(result, new Predicate<Integer>() {
        @Override
        public boolean apply(Integer input) {
            return !removedElements.contains(input);
        }
    });
    checkValues(new ArrayList<Integer>(subMap.values()));
}