Skip to content

Commit

Permalink
#813 CR
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyk committed May 10, 2018
1 parent 583603b commit 9c35316
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/test/java/org/cactoos/iterator/ImmutableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,22 @@ public void doesNotAllowRemovingOfElements() {
}

@Test
public void decoratesNextAndHasNext() {
public void decoratesNext() {
final int value = new Random().nextInt();
final Iterator<Integer> iter = new IteratorOf<>(value);
final Iterator<Integer> immutable = new Immutable<>(iter);
MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(true));
final Iterator<Integer> immutable = new Immutable<>(
new IteratorOf<>(value)
);
MatcherAssert.assertThat(immutable.next(), new IsEqual<>(value));
}

@Test
public void decoratesHasNext() {
final int value = new Random().nextInt();
final Iterator<Integer> immutable = new Immutable<>(
new IteratorOf<>(value)
);
MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(true));
immutable.next();
MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(false));
}
}

0 comments on commit 9c35316

Please sign in to comment.