]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.agent/src/test/java/org/argeo/slc/core/structure/tree/TreeSPathTest.java
1 package org
.argeo
.slc
.core
.structure
.tree
;
3 import junit
.framework
.TestCase
;
5 public class TreeSPathTest
extends TestCase
{
7 public void testNew() {
8 TreeSPath path
= new TreeSPath("/test");
9 assertEquals("test", path
.getName());
10 assertNull(path
.getParent());
12 path
= new TreeSPath("/root/subdir");
13 assertEquals("subdir", path
.getName());
14 assertEquals(new TreeSPath("/root"), path
.getParent());
17 public void testEquals() {
18 TreeSPath path1
= new TreeSPath("/test");
19 TreeSPath path2
= new TreeSPath("/test");
20 assertEquals(path1
, path2
);
22 path1
= new TreeSPath("/test/subdir/anotherdir");
23 path2
= new TreeSPath("/test/subdir/anotherdir");
24 assertEquals(path1
, path2
);
26 path1
= new TreeSPath("/test/subdir/anotherd");
27 path2
= new TreeSPath("/test/subdir/anotherdir");
28 assertNotSame(path1
, path2
);
30 path1
= new TreeSPath("/test/subdir");
31 path2
= new TreeSPath("/test/subdir/anotherdir");
32 assertNotSame(path1
, path2
);
34 path1
= new TreeSPath("/test/subd/anotherdir");
35 path2
= new TreeSPath("/test/subdir/anotherdir");
36 assertNotSame(path1
, path2
);
39 public void testCheckFormat(){
41 new TreeSPath("hello");
42 fail("Bad format should be rejected");
49 fail("Bad format should be rejected");
54 assertEquals(new TreeSPath("/test"), new TreeSPath("/test/"));
55 assertEquals(new TreeSPath("/test/dir"), new TreeSPath("//test///dir////"));