Created
February 22, 2017 08:59
-
-
Save madhu314/f4eba202e2ce0d71df7e79fe41fc58f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test public void testBatchedCallbacks() throws Exception { | |
SortedList<Article> articleSortedList = new SortedList<>(Article.class, | |
new SortedList.BatchedCallback<>(fixture.callbackRecorder())); | |
articleSortedList.beginBatchedUpdates(); | |
for (int i = 0; i < fixture.shuffledArticles().size(); i++) { | |
Article articleToAdd = fixture.shuffledArticles().get(i).dupe(); | |
articleSortedList.add(articleToAdd); | |
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo(0); | |
} | |
articleSortedList.endBatchedUpdates(); | |
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo(1); | |
assertThat(fixture.callbackRecorder().insertions().get(0).first).isEqualTo(0); | |
assertThat(fixture.callbackRecorder().insertions().get(0).second).isEqualTo( | |
fixture.shuffledArticles().size()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment