Created
February 22, 2017 08:54
-
-
Save madhu314/24566dde806d9de295fda44c5f85c11f 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 testChanges() throws Exception { | |
assertThat(fixture.sortedList().size()).isEqualTo(0); | |
addArticles(); | |
assertThat(fixture.callbackRecorder().insertions().size()).isEqualTo( | |
fixture.shuffledArticles().size()); | |
assertThat(fixture.callbackRecorder().deletions().size()).isEqualTo(0); | |
assertThat(fixture.callbackRecorder().moves().size()).isEqualTo(0); | |
assertThat(fixture.callbackRecorder().changes().size()).isEqualTo(0); | |
fixture.callbackRecorder().clear(); | |
int index = Article.Utils.randomWithRange(0, fixture.sortedList().size() - 1); | |
Article article = fixture.sortedList().get(index); | |
Article contentChanged = | |
article.toBuilder().content(Article.Utils.shuffleString(article.content())).build(); | |
fixture.sortedList().add(contentChanged); | |
Article changed = fixture.sortedList().get(index); | |
assertThat(changed.content()).isEqualTo(contentChanged.content()); | |
assertThat(changed.content()).isNotEqualTo(article.content()); | |
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(1); | |
assertThat(fixture.callbackRecorder().changes().get(0).first).isEqualTo(index); | |
assertThat(fixture.callbackRecorder().changes().get(0).second).isEqualTo(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment