diff options
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/path/PathTest.java')
-rw-r--r-- | vespajlib/src/test/java/com/yahoo/path/PathTest.java | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/path/PathTest.java b/vespajlib/src/test/java/com/yahoo/path/PathTest.java index aa09c491586..ae4581f1e9d 100644 --- a/vespajlib/src/test/java/com/yahoo/path/PathTest.java +++ b/vespajlib/src/test/java/com/yahoo/path/PathTest.java @@ -3,9 +3,8 @@ package com.yahoo.path; import org.junit.Test; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; /** @@ -15,85 +14,85 @@ import static org.junit.Assert.assertTrue; public class PathTest { @Test public void testGetName() { - assertThat(getAbsolutePath().getName(), is("baz")); - assertThat(getRelativePath().getName(), is("baz")); - assertThat(getWithSlashes().getName(), is("baz")); - assertThat(getAppended().getName(), is("baz")); - assertThat(getOne().getName(), is("foo")); + assertEquals("baz", getAbsolutePath().getName()); + assertEquals("baz", getRelativePath().getName()); + assertEquals("baz", getWithSlashes().getName()); + assertEquals("baz", getAppended().getName()); + assertEquals("foo", getOne().getName()); } @Test public void testEquals() { - assertTrue(getAbsolutePath().equals(getAbsolutePath())); - assertTrue(getAbsolutePath().equals(getRelativePath())); - assertTrue(getAbsolutePath().equals(getWithSlashes())); - assertTrue(getAbsolutePath().equals(getAppended())); - assertFalse(getAbsolutePath().equals(getOne())); - - assertTrue(getRelativePath().equals(getAbsolutePath())); - assertTrue(getRelativePath().equals(getRelativePath())); - assertTrue(getRelativePath().equals(getWithSlashes())); - assertTrue(getRelativePath().equals(getAppended())); - assertFalse(getRelativePath().equals(getOne())); - - assertTrue(getWithSlashes().equals(getAbsolutePath())); - assertTrue(getWithSlashes().equals(getRelativePath())); - assertTrue(getWithSlashes().equals(getWithSlashes())); - assertTrue(getWithSlashes().equals(getAppended())); - assertFalse(getWithSlashes().equals(getOne())); - - assertTrue(getAppended().equals(getAbsolutePath())); - assertTrue(getAppended().equals(getRelativePath())); - assertTrue(getAppended().equals(getWithSlashes())); - assertTrue(getAppended().equals(getAppended())); - assertFalse(getAppended().equals(getOne())); - - assertFalse(getOne().equals(getAbsolutePath())); - assertFalse(getOne().equals(getRelativePath())); - assertFalse(getOne().equals(getWithSlashes())); - assertFalse(getOne().equals(getAppended())); - assertTrue(getOne().equals(getOne())); + assertEquals(getAbsolutePath(), getAbsolutePath()); + assertEquals(getAbsolutePath(), getRelativePath()); + assertEquals(getAbsolutePath(), getWithSlashes()); + assertEquals(getAbsolutePath(), getAppended()); + assertNotEquals(getAbsolutePath(), getOne()); + + assertEquals(getRelativePath(), getAbsolutePath()); + assertEquals(getRelativePath(), getRelativePath()); + assertEquals(getRelativePath(), getWithSlashes()); + assertEquals(getRelativePath(), getAppended()); + assertNotEquals(getRelativePath(), getOne()); + + assertEquals(getWithSlashes(), getAbsolutePath()); + assertEquals(getWithSlashes(), getRelativePath()); + assertEquals(getWithSlashes(), getWithSlashes()); + assertEquals(getWithSlashes(), getAppended()); + assertNotEquals(getWithSlashes(), getOne()); + + assertEquals(getAppended(), getAbsolutePath()); + assertEquals(getAppended(), getRelativePath()); + assertEquals(getAppended(), getWithSlashes()); + assertEquals(getAppended(), getAppended()); + assertNotEquals(getAppended(), getOne()); + + assertNotEquals(getOne(), getAbsolutePath()); + assertNotEquals(getOne(), getRelativePath()); + assertNotEquals(getOne(), getWithSlashes()); + assertNotEquals(getOne(), getAppended()); + assertEquals(getOne(), getOne()); } @Test public void testGetPath() { - assertThat(getAbsolutePath().getRelative(), is("foo/bar/baz")); - assertThat(getRelativePath().getRelative(), is("foo/bar/baz")); - assertThat(getWithSlashes().getRelative(), is("foo/bar/baz")); - assertThat(getAppended().getRelative(), is("foo/bar/baz")); - assertThat(getOne().getRelative(), is("foo")); + assertEquals("foo/bar/baz", getAbsolutePath().getRelative()); + assertEquals("foo/bar/baz", getRelativePath().getRelative()); + assertEquals("foo/bar/baz", getWithSlashes().getRelative()); + assertEquals("foo/bar/baz", getAppended().getRelative()); + assertEquals("foo", getOne().getRelative()); } @Test public void testGetParentPath() { - assertThat(getAbsolutePath().getParentPath().getRelative(), is("foo/bar")); - assertThat(getRelativePath().getParentPath().getRelative(), is("foo/bar")); - assertThat(getWithSlashes().getParentPath().getRelative(), is("foo/bar")); - assertThat(getAppended().getParentPath().getRelative(), is("foo/bar")); - assertThat(getOne().getParentPath().getRelative(), is("")); + assertEquals("foo/bar", getAbsolutePath().getParentPath().getRelative()); + assertEquals("foo/bar", getRelativePath().getParentPath().getRelative()); + assertEquals("foo/bar", getWithSlashes().getParentPath().getRelative()); + assertEquals("foo/bar", getAppended().getParentPath().getRelative()); + assertTrue(getOne().getParentPath().getRelative().isEmpty()); } @Test public void testGetAbsolutePath() { - assertThat(getAbsolutePath().getAbsolute(), is("/foo/bar/baz")); - assertThat(getAbsolutePath().getParentPath().getAbsolute(), is("/foo/bar")); + assertEquals("/foo/bar/baz", getAbsolutePath().getAbsolute()); + assertEquals("/foo/bar", getAbsolutePath().getParentPath().getAbsolute()); } @Test public void testEmptyPath() { - assertThat(Path.createRoot().getName(), is("")); - assertThat(Path.createRoot().getRelative(), is("")); - assertThat(Path.createRoot().getParentPath().getRelative(), is("")); + assertTrue(Path.createRoot().getName().isEmpty()); + assertTrue(Path.createRoot().getRelative().isEmpty()); + assertTrue(Path.createRoot().getParentPath().getRelative().isEmpty()); assertTrue(Path.createRoot().isRoot()); } @Test public void testDelimiters() { - assertThat(Path.fromString("foo/bar", ",").getName(), is("foo/bar")); - assertThat(Path.fromString("foo/bar", "/").getName(), is("bar")); - assertThat(Path.fromString("foo,bar", "/").getName(), is("foo,bar")); - assertThat(Path.fromString("foo,bar", ",").getName(), is("bar")); - assertThat(Path.createRoot(",").append("foo").append("bar").getRelative(), is("foo,bar")); + assertEquals("foo/bar", Path.fromString("foo/bar", ",").getName()); + assertEquals("bar", Path.fromString("foo/bar", "/").getName()); + assertEquals("foo,bar", Path.fromString("foo,bar", "/").getName()); + assertEquals("bar", Path.fromString("foo,bar", ",").getName()); + assertEquals("foo,bar", Path.createRoot(",").append("foo").append("bar").getRelative()); } @Test @@ -101,9 +100,9 @@ public class PathTest { Path p1 = getAbsolutePath(); Path p2 = getAbsolutePath(); Path p3 = p1.append(p2); - assertThat(p1.getAbsolute(), is("/foo/bar/baz")); - assertThat(p2.getAbsolute(), is("/foo/bar/baz")); - assertThat(p3.getAbsolute(), is("/foo/bar/baz/foo/bar/baz")); + assertEquals("/foo/bar/baz", p1.getAbsolute()); + assertEquals("/foo/bar/baz", p2.getAbsolute()); + assertEquals("/foo/bar/baz/foo/bar/baz", p3.getAbsolute()); } private Path getRelativePath() { |