@Test
    void testBoundaries() {
        WordItem w = new WordItem("nalle");
        AndItem a = new AndItem();
        boolean caught = false;
        try {
            a.addItem(-1, w);
        } catch (IndexOutOfBoundsException e) {
            caught = true;
        }
        assertTrue(caught);
        caught = false;
        try {
            a.addItem(1, w);
        } catch (IndexOutOfBoundsException e) {
            caught = true;
        }
        assertTrue(caught);
        caught = false;
        try {
            a.setItem(-1, w);
        } catch (IndexOutOfBoundsException e) {
            caught = true;
        }
        assertTrue(caught);
        caught = false;
        try {
            a.setItem(0, w);
        } catch (IndexOutOfBoundsException e) {
            caught = true;
        }
        assertTrue(caught);
    }
Check basic contracts common to "many" item implementations.

@author Steinar Knutsen
container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java