From c74a3d6d7b7db4eeedcda9c2ae215c89c3b1394e Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Fri, 7 Sep 2012 11:07:57 +0300 Subject: Return short list instead of exception if less items available (#8028) Container.Indexed.getItemIds(int, int) does not throw an exception if too few items are available in the container. --- .../com/vaadin/data/util/TestIndexedContainer.java | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'server/tests/src/com/vaadin/data') diff --git a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java index da2e2feac7..20aadfcb8b 100644 --- a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java +++ b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java @@ -2,8 +2,9 @@ package com.vaadin.data.util; import java.util.List; +import junit.framework.Assert; + import com.vaadin.data.Item; -import com.vaadin.data.RangeOutOfContainerBoundsException; public class TestIndexedContainer extends AbstractInMemoryContainerTest { @@ -342,22 +343,9 @@ public class TestIndexedContainer extends AbstractInMemoryContainerTest { public void testGetItemIdsRangeIndexOutOfBoundsDueToSizeChange() { IndexedContainer ic = new IndexedContainer(); ic.addItem(new Object()); - try { - ic.getItemIds(0, 10); - fail("Container returned items when the range was >> container size"); - } catch (RangeOutOfContainerBoundsException e) { - // This is expected... - assertTrue(e.isAdditionalParametersSet()); - assertEquals(0, e.getStartIndex()); - assertEquals(10, e.getNumberOfIds()); - assertEquals(1, e.getContainerCurrentSize()); - - } catch (IndexOutOfBoundsException e) { - fail("Container threw wrong exception when the range exceeded container size... "); - } catch (Exception e) { - // Should not happen! - fail("Container threw unspecified exception when fetching a range of items and the range started from -1"); - } + Assert.assertEquals( + "Container returned too many items when the range was >> container size", + 1, ic.getItemIds(0, 10).size()); } // Ticket 8028 -- cgit v1.2.3