// Ticket 8028 @Test(expected = IllegalArgumentException.class) public void testGetItemIdsRangeNegativeRange() { IndexedContainer ic = new IndexedContainer(); ic.addItem(new Object()); List<Object> itemIds = ic.getItemIds(1, -1); assertTrue("Container returned actual values when asking for -1 items...", itemIds.isEmpty()); }
// Ticket 8028 @Test public void testGetItemIdsRangeZeroRange() { IndexedContainer ic = new IndexedContainer(); ic.addItem(new Object()); List<Object> itemIds = ic.getItemIds(1, 0); assertTrue("Container returned actual values when asking for 0 items...", itemIds.isEmpty()); }
// Ticket 8028 @Test public void testGetItemIdsRangeIndexOutOfBoundsDueToSizeChange() { IndexedContainer ic = new IndexedContainer(); ic.addItem(new Object()); Assert.assertEquals( "Container returned too many items when the range was >> container size", 1, ic.getItemIds(0, 10).size()); }
// Ticket 8028 @Test public void testGetItemIdsRangeBaseCase() { IndexedContainer ic = new IndexedContainer(); String object1 = new String("Obj1"); String object2 = new String("Obj2"); String object3 = new String("Obj3"); String object4 = new String("Obj4"); String object5 = new String("Obj5"); ic.addItem(object1); ic.addItem(object2); ic.addItem(object3); ic.addItem(object4); ic.addItem(object5); List<Object> itemIds = ic.getItemIds(1, 2); assertTrue(itemIds.contains(object2)); assertTrue(itemIds.contains(object3)); assertEquals(2, itemIds.size()); }
// Ticket 8028 @Test(expected = IndexOutOfBoundsException.class) public void testGetItemIdsRangeIndexOutOfBounds2() { IndexedContainer ic = new IndexedContainer(); ic.addItem(new Object()); ic.getItemIds(2, 1); }
// Ticket 8028 @Test(expected = IndexOutOfBoundsException.class) public void testGetItemIdsRangeIndexOutOfBounds() { IndexedContainer ic = new IndexedContainer(); ic.getItemIds(-1, 10); }