From 9c3531613ba5e29f9777012ddfcdca124d07cb8f Mon Sep 17 00:00:00 2001 From: Krzysztof Krason Date: Thu, 10 May 2018 16:41:33 +0200 Subject: [PATCH] #813 CR --- .../org/cactoos/iterator/ImmutableTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/cactoos/iterator/ImmutableTest.java b/src/test/java/org/cactoos/iterator/ImmutableTest.java index 2c7744fea8..3704b5ff54 100644 --- a/src/test/java/org/cactoos/iterator/ImmutableTest.java +++ b/src/test/java/org/cactoos/iterator/ImmutableTest.java @@ -50,12 +50,22 @@ public void doesNotAllowRemovingOfElements() { } @Test - public void decoratesNextAndHasNext() { + public void decoratesNext() { final int value = new Random().nextInt(); - final Iterator iter = new IteratorOf<>(value); - final Iterator immutable = new Immutable<>(iter); - MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(true)); + final Iterator 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 immutable = new Immutable<>( + new IteratorOf<>(value) + ); + MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(true)); + immutable.next(); MatcherAssert.assertThat(immutable.hasNext(), new IsEqual<>(false)); } }