### Question:
ListAdapterHelper { @SuppressWarnings("WeakerAccess") public void setList(final List<T> newList) { if (newList == mList) { return; } final int runGeneration = ++mMaxScheduledGeneration; if (newList == null) { mUpdateCallback.onRemoved(0, mList.size()); mList = null; return; } if (mList == null) { mUpdateCallback.onInserted(0, newList.size()); mList = newList; return; } final List<T> oldList = mList; mConfig.getBackgroundThreadExecutor().execute(new Runnable() { @Override public void run() { final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new DiffUtil.Callback() { @Override public int getOldListSize() { return oldList.size(); } @Override public int getNewListSize() { return newList.size(); } @Override public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { return mConfig.getDiffCallback().areItemsTheSame( oldList.get(oldItemPosition), newList.get(newItemPosition)); } @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mConfig.getDiffCallback().areContentsTheSame( oldList.get(oldItemPosition), newList.get(newItemPosition)); } }); mConfig.getMainThreadExecutor().execute(new Runnable() { @Override public void run() { if (mMaxScheduledGeneration == runGeneration) { latchList(newList, result); } } }); } }); } @SuppressWarnings("WeakerAccess")  ListAdapterHelper(ListUpdateCallback listUpdateCallback,
            ListAdapterConfig<T> config); @SuppressWarnings("WeakerAccess") T getItem(int index); @SuppressWarnings("WeakerAccess") int getItemCount(); @SuppressWarnings("WeakerAccess") void setList(final List<T> newList);  }### Answer:
@Test public void setListUpdate() { ListUpdateCallback callback = mock(ListUpdateCallback.class); ListAdapterHelper<String> helper = createHelper(callback, STRING_DIFF_CALLBACK); helper.setList(Arrays.asList("a", "b")); verify(callback).onInserted(0, 2); verifyNoMoreInteractions(callback); drain(); verifyNoMoreInteractions(callback); helper.setList(Arrays.asList("a", "b", "c")); verifyNoMoreInteractions(callback); drain(); verify(callback).onInserted(2, 1); verifyNoMoreInteractions(callback); helper.setList(null); verify(callback).onRemoved(0, 3); verifyNoMoreInteractions(callback); drain(); verifyNoMoreInteractions(callback); }