test: cll find item
This commit is contained in:
@@ -160,7 +160,21 @@ public class CustomLinkedListTest {
|
||||
|
||||
}
|
||||
|
||||
private CustomLinkedList<String> initPopulatedList(String[] initData) {
|
||||
@Test
|
||||
void cllFind_shouldFindCorrectItem() {
|
||||
CustomLinkedList<String> list = initPopulatedList("Ahoj", "ja", "jsem", "kkt");
|
||||
|
||||
CustomLinkedList<String> foundItems = list.find(i -> i.length() == 4);
|
||||
|
||||
assertThat(foundItems.size()).isEqualTo(2);
|
||||
|
||||
assertThat(foundItems.contains("Ahoj")).isTrue();
|
||||
assertThat(foundItems.contains("jsem")).isTrue();
|
||||
assertThat(foundItems.contains("kkt")).isFalse();
|
||||
|
||||
}
|
||||
|
||||
private CustomLinkedList<String> initPopulatedList(String... initData) {
|
||||
CustomLinkedList<String> list = new CustomLinkedListImpl<>();
|
||||
Stream.of(initData).forEach(list::add);
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user