package ee.shy.core;

import org.junit.Test;

import static org.junit.Assert.*;

public class TreePathTest {
    @Test
    public void testResolve() throws Exception {
        TreePath path1 = new TreePath().resolve("foo");
        TreePath path2 = new TreePath().resolve("foo").resolve("bar");

        assertEquals(path1.resolve("bar").toString(), path2.toString());
    }

    @Test
    public void testToString() throws Exception {
        assertEquals("/", new TreePath().toString());
        assertEquals("/foo", new TreePath().resolve("foo").toString());
    }

    @Test
    public void testCompareTo() throws Exception {
        assertEquals(0, new TreePath().compareTo(new TreePath()));
        assertEquals(0, new TreePath().resolve("foo").compareTo(new TreePath().resolve("foo")));
        assertTrue(new TreePath().compareTo(new TreePath().resolve("foo")) > 0);
        assertTrue(new TreePath().resolve("foo").resolve("bar").compareTo(new TreePath().resolve("foo")) < 0);
    }

}
@@ -547,38 +547,145 @@
 %22).toString());%0A
+        assertEquals(%22/foo/bar/baz.txt%22, new TreePath().resolve(%22foo/bar%22).resolve(%22baz.txt%22).toString());%0A
     %7D%0A
-
 %0A    @Test%0A    p
@@ -890,24 +890,25 @@
 e(%22foo%22)));%0A
+%0A
         asse
@@ -974,9 +974,9 @@
 %22)) 
-%3E
+%3C
  0);
@@ -1083,20 +1083,160 @@
 oo%22)
-) %3C 0);%0A    %7D%0A
+.resolve(%22baz%22).resolve(%22shz%22)) %3C 0);%0A        assertTrue(new TreePath().resolve(%22foo%22).resolve(%22bar%22).compareTo(new TreePath().resolve(%22foo%22)) %3E 0);%0A    %7D
 %0A%7D

Correct TreePath tests