test: linked list add and size
This commit is contained in:
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user