Enhance docs, add more tests in DynamicArray (#5952)

This commit is contained in:
Hardik Pawar
2024-10-23 23:30:38 +05:30
committed by GitHub
parent d868982a72
commit 4f7957ff14
2 changed files with 88 additions and 22 deletions

View File

@@ -24,6 +24,8 @@ public class DynamicArrayTest {
public void testGetElement() {
array.add("Alice");
array.add("Bob");
array.add("Charlie");
array.add("David");
assertEquals("Bob", array.get(1));
}
@@ -31,6 +33,7 @@ public class DynamicArrayTest {
public void testGetInvalidIndex() {
assertThrows(IndexOutOfBoundsException.class, () -> array.get(-1));
assertThrows(IndexOutOfBoundsException.class, () -> array.get(10));
assertThrows(IndexOutOfBoundsException.class, () -> array.get(100));
}
@Test