diff --git a/README.md b/README.md
index 4106cab..8cd66da 100644
--- a/README.md
+++ b/README.md
@@ -15,16 +15,16 @@ Achtung! Die Methoden müssen für die Aufgabe ein wenig angepasst werden.
| Methode | Parameter | Rückgabetyp | Rückgabewert |
| - | - | - | - |
| add(String n) | n: String to be appended | void
-| add(int index, String n) | index: index at which the specified String is to be inserted
n: String to be inserted | Boolean | true: erfolgreich
false: fehlgeschlagen
+| add(int index, String n) | index: index at which the specified String is to be inserted
n: String to be inserted | Boolean | true: erfolgreich
false: fehlgeschlagen (out of bounds)
| addAll(MeineArrayList liste) | liste: list wich gets appended | void |
-| addAll(int index, MeineArrayList liste) | index: index at which to insert the first element
list: list containing Strings to be added to this list | Boolean | true: erfolgreich
false: fehlgeschlagen
+| addAll(int index, MeineArrayList liste) | index: index at which to insert the first element
list: list containing Strings to be added to this list | Boolean | true: erfolgreich
false: fehlgeschlagen (out of bounds)
clear() | | void | |
contains(String s) | s: String to search | Boolean | true: the same String exists (s.eaquals()) in the list
false: the String doesn't exists in the list.
-get(int index) | index: index to return | String | returns the String from the specifed index |
+get(int index) | index: index to return | String | returns the String from the specifed index
retruns an empty String if index is out of bounds |
indexOf(String s) | s: String to search | int | Returns the index of the first eaqual String in this list, or -1 if this list does not contain the element. |
isEmpty() | | Boolean | Returns true if the list contains no elements. |
-remove(int index) | index: index to remove | String | removes the specified index and returns the removed String.
-set(int index, String s) | index: index to replace
s: String to replace with. | Boolean | Replaces the String at the specified position in this list with the specified String. |
+remove(int index) | index: index to remove | String | removes the specified index and returns the removed String.
returns empty String if the index is out of bounds and doesn't remove anything
+set(int index, String s) | index: index to replace
s: String to replace with. | Boolean | Replaces the String at the specified position in this list with the specified String.
returns false if index is out of bounds and does nothing else true |
size() | | int | Returns the number of elements in this list.
-toArray() | | String[] | Returns an array containing all Strings in this list in proper sequence (from first to last String). The returned Array is a deep copy. This means that if you change a String in the returned Array the String isn't changed in this list.
+toArray() | | String[] | Returns an array containing all Strings in this list in proper sequence (from first to last String). The returned Array is a deep copy. This means that if you change a String in the returned Array the String isn't changed in this list
diff --git a/src/de/hs_mannheim/MeineArrayList/MeineArrayList_Test.java b/src/de/hs_mannheim/MeineArrayList/MeineArrayList_Test.java
index d92049d..34468fe 100755
--- a/src/de/hs_mannheim/MeineArrayList/MeineArrayList_Test.java
+++ b/src/de/hs_mannheim/MeineArrayList/MeineArrayList_Test.java
@@ -11,6 +11,7 @@ class MeineArrayList_Test {
MeineArrayList list = new MeineArrayList();
list.add("Test");
assertEquals("Test", list.get(0));
+ assertEquals("", list.get(10));
}
@Test
@@ -22,12 +23,11 @@ class MeineArrayList_Test {
assertEquals("Test2", list.get(1));
list.add("Test3");
assertEquals("Test3", list.get(2));
- list.add(0, "Test4");
+ assertTrue(list.add(0, "Test4"));
assertEquals("Test4", list.get(0));
- list.add(4, "Test5");
+ assertTrue(list.add(4, "Test5"));
assertEquals("Test5", list.get(4));
assertFalse(list.add(10,"testw3"));
- assertTrue(list.add(0,"testw3"));
}
@Test
@@ -51,7 +51,7 @@ class MeineArrayList_Test {
assertEquals("2", liste1.get(5));
assertEquals("3", liste1.get(6));
assertEquals("4", liste1.get(7));
- liste1.addAll(1,liste2);
+ assertTrue(liste1.addAll(1,liste2));
assertEquals("1", liste1.get(0));
assertEquals("1", liste1.get(1));
assertEquals("2", liste1.get(2));
@@ -64,6 +64,7 @@ class MeineArrayList_Test {
assertEquals("2", liste1.get(9));
assertEquals("3", liste1.get(10));
assertEquals("4", liste1.get(11));
+ assertFalse(liste1.addAll(100,liste2));
}
@Test
@@ -116,6 +117,7 @@ class MeineArrayList_Test {
assertEquals("2", list.remove(0));
assertEquals("3", list.remove(0));
assertEquals("4", list.remove(0));
+ assertEquals("", list.remove(0));
}
@Test
@@ -156,5 +158,9 @@ class MeineArrayList_Test {
assertArrayEquals(new String[] {"1","2","3"}, list.toArray());
list.add("4");
assertArrayEquals(new String[] {"1","2","3","4"}, list.toArray());
+ String[] tmparr = list.toArray();
+ tmparr[0] = "test";
+ assertEquals("test", tmparr[0]);
+ assertEquals("1", list.get(0));
}
}