Junior — Senior
Check that the list size remains unchanged with an incorrect index
livecode
Task condition
Add to the second parameterized test a check that the list size does not change, even if you try to get an element by an invalid index.
@ParameterizedTest
@ValueSource(ints = {-1, 10})
void shouldReturnEmptyWhenIndexIsIncorrect(int index) {
Node<Integer> listNode = new ListNode<>(1);
var result = listNode.get(index);
assertTrue(result.isEmpty());
assertEquals(1, listNode.size());
}