Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6590e02bd4
|
@ -39,7 +39,8 @@ public class ListOfListsTest {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void givenListOfLists_whenRemovingElements_thenCheckNames() {
|
public void givenListOfLists_whenRemovingElements_thenCheckNames() {
|
||||||
((ArrayList<Pencil>) listOfLists.get(1)).remove(0);
|
|
||||||
|
((ArrayList<Pencil>) listOfLists.get(1)).remove(0);
|
||||||
listOfLists.remove(1);
|
listOfLists.remove(1);
|
||||||
assertEquals("Rubber 1", ((Rubber) listOfLists.get(1)
|
assertEquals("Rubber 1", ((Rubber) listOfLists.get(1)
|
||||||
.get(0)).getName());
|
.get(0)).getName());
|
||||||
|
@ -47,4 +48,29 @@ public class ListOfListsTest {
|
||||||
assertEquals("Rubber 1", ((Rubber) listOfLists.get(0)
|
assertEquals("Rubber 1", ((Rubber) listOfLists.get(0)
|
||||||
.get(0)).getName());
|
.get(0)).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenThreeList_whenCombineIntoOneList_thenCheckList() {
|
||||||
|
ArrayList<Pen> pens = new ArrayList<>();
|
||||||
|
pens.add(new Pen("Pen 1"));
|
||||||
|
pens.add(new Pen("Pen 2"));
|
||||||
|
ArrayList<Pencil> pencils = new ArrayList<>();
|
||||||
|
pencils.add(new Pencil("Pencil 1"));
|
||||||
|
pencils.add(new Pencil("Pencil 2"));
|
||||||
|
ArrayList<Rubber> rubbers = new ArrayList<>();
|
||||||
|
rubbers.add(new Rubber("Rubber 1"));
|
||||||
|
rubbers.add(new Rubber("Rubber 2"));
|
||||||
|
|
||||||
|
List<ArrayList<? extends Stationery>> list = new ArrayList<ArrayList<? extends Stationery>>();
|
||||||
|
list.add(pens);
|
||||||
|
list.add(pencils);
|
||||||
|
list.add(rubbers);
|
||||||
|
|
||||||
|
assertEquals("Pen 1", ((Pen) list.get(0)
|
||||||
|
.get(0)).getName());
|
||||||
|
assertEquals("Pencil 1", ((Pencil) list.get(1)
|
||||||
|
.get(0)).getName());
|
||||||
|
assertEquals("Rubber 1", ((Rubber) list.get(2)
|
||||||
|
.get(0)).getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue