Skip to content

Instantly share code, notes, and snippets.

@madhu314
Last active February 22, 2017 08:51
Show Gist options
  • Save madhu314/e4ecbc8e5536bb5784a6b131cc5f14ad to your computer and use it in GitHub Desktop.
Save madhu314/e4ecbc8e5536bb5784a6b131cc5f14ad to your computer and use it in GitHub Desktop.
@Test public void testAdditionOfSameObjectShouldNotChangeSortedList() throws Exception {
assertThat(fixture.sortedList().size()).isEqualTo(0);
Article article = fixture.orderedArticleList()
.get(Article.Utils.randomWithRange(0, fixture.orderedArticleList().size() - 1));
fixture.sortedList().add(article);
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo(1);
assertThat(fixture.callbackRecorder().deletions().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().moves().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().changes().size()).isEqualTo(0);
fixture.callbackRecorder().clear();
assertThat(fixture.sortedList().size()).isEqualTo(1);
for (int i = 0; i < Article.Utils.randomWithRange(1, 10); i++) {
fixture.sortedList().add(article.dupe());
}
assertThat(fixture.sortedList().size()).isEqualTo(1);
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().deletions().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().moves().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().changes().size()).isEqualTo(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment