test: linked list add and size

This commit is contained in:
Václav Přibík
2025-10-16 15:08:32 +02:00
parent e1a480610c
commit c3932eb440

View File

@@ -0,0 +1,39 @@
package appointmentplanner.customlist.api;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import appointmentplanner.customlist.CustomLinkedListImpl;
public class CustomLinkedListTest {
@Test
void cllAddandCllSize_shouldAddElementSuccessfullyAndCalculateSizeSuccessfully() {
CustomLinkedList<String> list = new CustomLinkedListImpl<>();
int counter = 0;
assertThat(list.size()).isEqualTo(counter);
for (String word : new String[] { "Ahoj", "jak", "se", "mas", "vole" }) {
counter++;
list.add(word);
assertThat(list.size()).isEqualTo(counter);
}
}
@ParameterizedTest
@CsvSource({
"'Ahoj, jak, to, jde', 'to', true",
"'Ty, jsi, ale, hloupy', 'to', false"
})
void cllContains_shouldReturnCorrectResult(String[] data, String toContain, boolean shouldContain) {
}
}