Seems no conflict (#1274)
* Bean Injection Project is added Different Types of Bean Injection article codes are added. * Java-based configuration added Java-based configuration and tests are added. Coding styles are fixed. * List of Lists Article Codes added. List of Lists Article Codes added. * Most popular use case of grouping elements together added Most popular use case of grouping elements together added
This commit is contained in:
parent
442c00545c
commit
52a3565f39
|
@ -39,7 +39,8 @@ public class ListOfListsTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void givenListOfLists_whenRemovingElements_thenCheckNames() {
|
||||
((ArrayList<Pencil>) listOfLists.get(1)).remove(0);
|
||||
|
||||
((ArrayList<Pencil>) listOfLists.get(1)).remove(0);
|
||||
listOfLists.remove(1);
|
||||
assertEquals("Rubber 1", ((Rubber) listOfLists.get(1)
|
||||
.get(0)).getName());
|
||||
|
@ -47,4 +48,29 @@ public class ListOfListsTest {
|
|||
assertEquals("Rubber 1", ((Rubber) listOfLists.get(0)
|
||||
.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