Asserts for check
This commit is contained in:
51
test/aud/exam/prep/list/DoubleListItemProcessorTest.java
Normal file
51
test/aud/exam/prep/list/DoubleListItemProcessorTest.java
Normal file
@ -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<DoubleListItem<Integer>> {
|
||||||
|
|
||||||
|
protected DoubleListItemProcessorTest(SequenceProcessor<Integer, DoubleListItem<Integer>> processor) {
|
||||||
|
super(processor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testThat_checkOfNullIsTrue() {
|
||||||
|
assertTrue(processor.check(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testThat_checkOfNoKeyIsFalse() {
|
||||||
|
var item = new DoubleListItem<Integer>();
|
||||||
|
assertFalse(processor.check(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testThat_checkOfNoPrevOfNextIsFalse() {
|
||||||
|
var item = new DoubleListItem<Integer>();
|
||||||
|
item.key = 1;
|
||||||
|
|
||||||
|
item.next = new DoubleListItem<>();
|
||||||
|
item.next.key = 1;
|
||||||
|
|
||||||
|
assertFalse(processor.check(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testThat_checkOfCircleIsFalse() {
|
||||||
|
var item = new DoubleListItem<Integer>();
|
||||||
|
item.next = item;
|
||||||
|
assertFalse(processor.check(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testThat_checkPrevNextNotMatchingIsFalse() {
|
||||||
|
var item = new DoubleListItem<Integer>();
|
||||||
|
item.next = new DoubleListItem<>();
|
||||||
|
item.next.prev = new DoubleListItem<>();
|
||||||
|
assertFalse(processor.check(item));
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,8 @@
|
|||||||
package aud.exam.prep.list;
|
package aud.exam.prep.list;
|
||||||
|
|
||||||
import aud.exam.prep.SequenceProcessorTest;
|
public class RecursiveDoubleListItemProcessorTest extends DoubleListItemProcessorTest {
|
||||||
|
|
||||||
class RecursiveDoubleListItemProcessorTest extends SequenceProcessorTest<DoubleListItem<Integer>> {
|
|
||||||
|
|
||||||
protected RecursiveDoubleListItemProcessorTest() {
|
protected RecursiveDoubleListItemProcessorTest() {
|
||||||
super(new RecursiveDoubleListItemProcessor<>());
|
super(new RecursiveDoubleListItemProcessor<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user