test: custom linked list contains
This commit is contained in:
@@ -2,10 +2,14 @@ package appointmentplanner.customlist.api;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.converter.ConvertWith;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
|
|
||||||
|
import appointmentplanner.StringArrayConverter;
|
||||||
import appointmentplanner.customlist.CustomLinkedListImpl;
|
import appointmentplanner.customlist.CustomLinkedListImpl;
|
||||||
|
|
||||||
public class CustomLinkedListTest {
|
public class CustomLinkedListTest {
|
||||||
@@ -32,7 +36,14 @@ public class CustomLinkedListTest {
|
|||||||
"'Ty, jsi, ale, hloupy', 'to', false"
|
"'Ty, jsi, ale, hloupy', 'to', false"
|
||||||
|
|
||||||
})
|
})
|
||||||
void cllContains_shouldReturnCorrectResult(String[] data, String toContain, boolean shouldContain) {
|
void cllContains_shouldReturnCorrectResult(@ConvertWith(StringArrayConverter.class) String[] data, String toContain,
|
||||||
|
boolean shouldContain) {
|
||||||
|
|
||||||
|
CustomLinkedList<String> list = new CustomLinkedListImpl<>();
|
||||||
|
|
||||||
|
Stream.of(data).forEach(list::add);
|
||||||
|
|
||||||
|
assertThat(list.contains(toContain)).isEqualTo(shouldContain);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user