Skip to content

Instantly share code, notes, and snippets.

@madhu314
Created February 22, 2017 08:56
Show Gist options
  • Save madhu314/7253ff7ef30356d26e7762b21cbbfa4e to your computer and use it in GitHub Desktop.
Save madhu314/7253ff7ef30356d26e7762b21cbbfa4e to your computer and use it in GitHub Desktop.
@Test public void testDeletions() throws Exception {
assertThat(fixture.sortedList().size()).isEqualTo(0);
addArticles();
fixture.callbackRecorder().clear();
int index = Article.Utils.randomWithRange(0, fixture.sortedList().size() - 1);
Article articleToDelete = fixture.sortedList().get(index).dupe();
boolean deleted = fixture.sortedList().remove(articleToDelete);
assertThat(deleted).isTrue();
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().moves().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().changes().size()).isEqualTo(0);
assertThat(fixture.callbackRecorder().deletions().size()).isEqualTo(1);
assertThat(fixture.callbackRecorder().deletions().get(0).first).isEqualTo(index);
assertThat(fixture.callbackRecorder().deletions().get(0).second).isEqualTo(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment