@Test
    public void assertCompareTo() {
        populateSpanTree();
        assertEquals(1 , span1.compareTo(span2));
        assertEquals(-1, span2.compareTo(span1));
        assertEquals(-1 , span2.compareTo(span3));
        assertEquals(1, span3.compareTo(span2));
        assertEquals(0, span2.compareTo(span111));
        assertEquals(1, root.compareTo(branch));
        assertEquals(-1, alternate1.compareTo(root));
        assertEquals(1, branch.compareTo(span22));
        assertEquals(-1, branch.compareTo(alternate2));
        assertEquals(1, alternate2.compareTo(root));
        assertEquals(-1, span111.compareTo(root));
        assertEquals(0, span333.compareTo(branch1));
        assertEquals(0, alternate2.compareTo(span33));
        root.removeChildren();
        tree.cleanup();
        assertEquals(1, span11.compareTo(root));
    }
@author <a href="mailto:mpraveen@yahoo-inc.com">Praveen Mohan</a>

This test covers all possible scenarios in SpanNode.
document/src/test/java/com/yahoo/document/annotation/SpanNodeAdvTestCase.java