diff --git a/test/aud/exam/prep/list/DoubleListItemProcessorTest.java b/test/aud/exam/prep/list/DoubleListItemProcessorTest.java new file mode 100644 index 0000000..85be768 --- /dev/null +++ b/test/aud/exam/prep/list/DoubleListItemProcessorTest.java @@ -0,0 +1,51 @@ +package aud.exam.prep.list; + +import aud.exam.prep.SequenceProcessor; +import aud.exam.prep.SequenceProcessorTest; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +abstract class DoubleListItemProcessorTest extends SequenceProcessorTest> { + + protected DoubleListItemProcessorTest(SequenceProcessor> processor) { + super(processor); + } + + @Test + void testThat_checkOfNullIsTrue() { + assertTrue(processor.check(null)); + } + + @Test + void testThat_checkOfNoKeyIsFalse() { + var item = new DoubleListItem(); + assertFalse(processor.check(item)); + } + + @Test + void testThat_checkOfNoPrevOfNextIsFalse() { + var item = new DoubleListItem(); + item.key = 1; + + item.next = new DoubleListItem<>(); + item.next.key = 1; + + assertFalse(processor.check(item)); + } + + @Test + void testThat_checkOfCircleIsFalse() { + var item = new DoubleListItem(); + item.next = item; + assertFalse(processor.check(item)); + } + + @Test + void testThat_checkPrevNextNotMatchingIsFalse() { + var item = new DoubleListItem(); + item.next = new DoubleListItem<>(); + item.next.prev = new DoubleListItem<>(); + assertFalse(processor.check(item)); + } +} \ No newline at end of file diff --git a/test/aud/exam/prep/list/RecursiveDoubleListItemProcessorTest.java b/test/aud/exam/prep/list/RecursiveDoubleListItemProcessorTest.java index 60ab264..e3d8d09 100644 --- a/test/aud/exam/prep/list/RecursiveDoubleListItemProcessorTest.java +++ b/test/aud/exam/prep/list/RecursiveDoubleListItemProcessorTest.java @@ -1,10 +1,8 @@ package aud.exam.prep.list; -import aud.exam.prep.SequenceProcessorTest; - -class RecursiveDoubleListItemProcessorTest extends SequenceProcessorTest> { +public class RecursiveDoubleListItemProcessorTest extends DoubleListItemProcessorTest { protected RecursiveDoubleListItemProcessorTest() { super(new RecursiveDoubleListItemProcessor<>()); } -} \ No newline at end of file +}