diff options
author | Henri Sara <hesara@vaadin.com> | 2012-09-07 11:07:57 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-09-07 11:07:57 +0300 |
commit | c74a3d6d7b7db4eeedcda9c2ae215c89c3b1394e (patch) | |
tree | 8c5b87f20fc7b57e733a1973d320d552ab84049a /server/tests/src/com/vaadin/data | |
parent | 78fcee9817e2216eab619f8f750cf6eda7f545d9 (diff) | |
download | vaadin-framework-c74a3d6d7b7db4eeedcda9c2ae215c89c3b1394e.tar.gz vaadin-framework-c74a3d6d7b7db4eeedcda9c2ae215c89c3b1394e.zip |
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.
Diffstat (limited to 'server/tests/src/com/vaadin/data')
-rw-r--r-- | server/tests/src/com/vaadin/data/util/TestIndexedContainer.java | 22 |
1 files changed, 5 insertions, 17 deletions
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 |