diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-07-02 18:05:22 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-07-02 18:05:22 -0400 |
| commit | 843329de434bb334d90927c4d22345373a388530 (patch) | |
| tree | b0ad1f764bd29ff43841e1095a5b58194c20cb37 /src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java | |
| parent | ac36f171a3cebb0993cc28548635e3f654f8e325 (diff) | |
Rename package root
The package root is now bjc, not io.github.bculkin2442.
Diffstat (limited to 'src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java')
| -rw-r--r-- | src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java b/src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java new file mode 100644 index 0000000..80fbb54 --- /dev/null +++ b/src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java @@ -0,0 +1,49 @@ +package io.github.bculkin2442.data; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import bjc.data.CircularIterator; + +import static io.github.bculkin2442.TestUtils.*; +/** + * Test for circular iterators., + * + * @author bjculkin + * + */ +public class CircularIteratorTest { + /** + * Test regular repetition of the entire iterator. + */ + @Test + public void testRegular() { + List<String> lst = Arrays.asList("a", "b", "c"); + + CircularIterator<String> itr = new CircularIterator<>(lst); + + // Check we get initial values correctly, and have more remaining + assertIteratorEquals(true, itr, "a", "b", "c"); + + // Check we repeat correctly, and can still repeat + assertIteratorEquals(true, itr, "a", "b", "c"); + } + + /** + * Test that the last element repeats correctly. + */ + @Test + public void testRepLast() { + List<String> lst = Arrays.asList("a", "b", "c"); + + CircularIterator<String> itr = new CircularIterator<>(lst, false); + + // Check we get initial values correctly, and have more remaining + assertIteratorEquals(true, itr, "a", "b", "c"); + + // Check we repeat correctly, and can still repeat + assertIteratorEquals(true, itr, "c", "c", "c"); + } +} |
