@Test
    public void testAddingToManyRoots() {
        Span s1 = new Span(1, 1);
        Span s2 = new Span(2, 1);
        Span s3 = new Span(3, 1);

        SpanList sl1 = new SpanList();
        sl1.add(s1).add(s2).add(s3);

        SpanList sl2 = new SpanList();
        try {
            sl2.add(s1).add(s2).add(s3);
            fail("Should have failed here!!");
        } catch (IllegalStateException ise) {
            //OK!
        }

        SpanTree tree = new SpanTree("foo", sl1);
        assertSame(tree, sl1.getParent());
        assertSame(sl1, tree.getRoot());

        SpanList sl3 = new SpanList();
        sl1.add(sl3);
        assertSame(sl3, sl1.children().get(3));
        assertSame(sl1, sl3.getParent());

        assertSame(tree, sl3.getSpanTree());
        assertSame(tree, sl1.getSpanTree());

        assertNull(sl2.getSpanTree());
    }
@author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
document/src/test/java/com/yahoo/document/annotation/SpanListTestCase.java