@Test
    public void testFromAndTo() {
        Span s1 = new Span(1, 2);
        Span s2 = new Span(5, 10);

        SpanList list = new SpanList();

        assertEquals(-1, list.getFrom());
        assertEquals(-1, list.getTo());

        list.add(s1);
        assertEquals(1, list.getFrom());
        assertEquals(1, list.getFrom());
        assertEquals(3, list.getTo());
        assertEquals(3, list.getTo());

        list.add(s2);
        assertEquals(1, list.getFrom());
        assertEquals(1, list.getFrom());
        assertEquals(15, list.getTo());
        assertEquals(15, list.getTo());

        list.clearChildren();
        assertEquals(-1, list.getFrom());
        assertEquals(-1, list.getTo());

        s1 = new Span(1, 2);
        s2 = new Span(5, 10);

        list.add(s1);
        assertEquals(1, list.getFrom());
        assertEquals(1, list.getFrom());
        assertEquals(3, list.getTo());
        assertEquals(3, list.getTo());

        list.add(s2);
        assertEquals(1, list.getFrom());
        assertEquals(1, list.getFrom());
        assertEquals(15, list.getTo());
        assertEquals(15, list.getTo());

        list.remove(s1);
        assertEquals(5, list.getFrom());
        assertEquals(5, list.getFrom());
        assertEquals(15, list.getTo());
        assertEquals(15, list.getTo());

        list.remove(s2);
        assertEquals(-1, list.getFrom());
        assertEquals(-1, list.getTo());
    }
@author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
document/src/test/java/com/yahoo/document/annotation/SpanListTestCase.java