コード例 #1
0
 @Test
 public void testResize() throws Exception {
   assertEquals(0, list.size());
   list.resize(1); // Resize to 1 should add 1 item and 0 should be Item::index
   assertEquals(1, list.size());
   assertEquals(0, list.get(0).getIndex());
   list.resize(2); // Resize to 2 should add 1 new item and 1 should be Item::index
   assertEquals(2, list.size());
   assertEquals(1, list.get(1).getIndex());
 }
コード例 #2
0
 @Test
 public void testResizeDown() throws Exception {
   list.resize(2); // Resize to 2 should add 2 items and 0 and 1 as Item::index
   assertEquals(2, list.size());
   assertEquals(0, list.get(0).getIndex());
   assertEquals(1, list.get(1).getIndex());
   list.resize(1); // Resize to 2 should have no effect
   assertEquals(2, list.size());
   assertEquals(0, list.get(0).getIndex());
   assertEquals(1, list.get(1).getIndex());
 }