@Test
    void testSetItem() {
        PhraseItem backup = new PhraseItem();
        PhraseSegmentItem segment = new PhraseSegmentItem("", false, false);
        PhraseItem innerPhrase = new PhraseItem();
        WordItem testWord = new WordItem("z");
        PhraseItem p;
        segment.addItem(new WordItem("p"));
        segment.addItem(new WordItem("q"));
        innerPhrase.addItem(new WordItem("x"));
        innerPhrase.addItem(new WordItem("y"));
        backup.addItem(new WordItem("a"));
        backup.addItem(new WordItem("b"));
        backup.addItem(new WordItem("c"));

        p = (PhraseItem) backup.clone();
        p.setItem(0, segment);
        assertEquals("\"'p q' b c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(1, segment);
        assertEquals("\"a 'p q' c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(2, segment);
        assertEquals("\"a b 'p q'\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(0, innerPhrase);
        assertEquals("\"x y b c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(1, innerPhrase);
        assertEquals("\"a x y c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(2, innerPhrase);
        assertEquals("\"a b x y\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(0, testWord);
        assertEquals("\"z b c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(1, testWord);
        assertEquals("\"a z c\"", p.toString());

        p = (PhraseItem) backup.clone();
        p.setItem(2, testWord);
        assertEquals("\"a b z\"", p.toString());
    }
Test methods changing phrase items.

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