test: cll to array list
This commit is contained in:
@@ -2,6 +2,7 @@ package appointmentplanner.customlist.api;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -174,6 +175,20 @@ public class CustomLinkedListTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void cllToArrayList() {
|
||||||
|
|
||||||
|
String[] items = new String[] { "Uz", "toho", "mam", "dost" };
|
||||||
|
|
||||||
|
CustomLinkedList<String> ll = initPopulatedList(items);
|
||||||
|
|
||||||
|
ArrayList<String> convertedAl = ll.toArrayList();
|
||||||
|
|
||||||
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
assertThat(items[i]).isEqualTo(convertedAl.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private CustomLinkedList<String> initPopulatedList(String... initData) {
|
private CustomLinkedList<String> initPopulatedList(String... initData) {
|
||||||
CustomLinkedList<String> list = new CustomLinkedListImpl<>();
|
CustomLinkedList<String> list = new CustomLinkedListImpl<>();
|
||||||
Stream.of(initData).forEach(list::add);
|
Stream.of(initData).forEach(list::add);
|
||||||
|
|||||||
Reference in New Issue
Block a user