Skip to content

Commit

Permalink
Added missing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilia committed Jun 19, 2017
1 parent 97b6ae2 commit 9b4868a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/test/java/org/cactoos/list/CycledIterableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.cactoos.list;

import java.util.Collections;
import org.cactoos.ScalarHasValue;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
Expand All @@ -47,12 +48,25 @@ public void repeatIterableTest() throws Exception {
"one", expected, "three"
)
),
// @checkstyle MagicNumberCheck (1 line)
// @checkstyle MagicNumberCheck (1 line)<
7
),
new ScalarHasValue<>(
expected
)
);
}

@Test()
public void notCycledEmptyTest() throws Exception {
MatcherAssert.assertThat(
"Can't generate an empty iterable",
new LengthOfIterable(
new CycledIterable<>(
Collections::emptyIterator
)
),
new ScalarHasValue<>(0)
);
}
}
9 changes: 9 additions & 0 deletions src/test/java/org/cactoos/list/CycledIteratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package org.cactoos.list;

import java.util.Collections;
import java.util.NoSuchElementException;
import org.cactoos.ScalarHasValue;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
Expand Down Expand Up @@ -55,4 +57,11 @@ public void repeatIteratorTest() throws Exception {
)
);
}

@Test(expected = NoSuchElementException.class)
public void notCycledEmptyTest() throws Exception {
new CycledIterator<>(
Collections::emptyIterator
).next();
}
}

0 comments on commit 9b4868a

Please sign in to comment.