New LogMessageExtractorCheck which writes out TXT report of all loggers
[yangtools.git] / common / checkstyle-logging / src / test / java / org / opendaylight / yangtools / checkstyle / FileNameUtilTest.java
diff --git a/common/checkstyle-logging/src/test/java/org/opendaylight/yangtools/checkstyle/FileNameUtilTest.java b/common/checkstyle-logging/src/test/java/org/opendaylight/yangtools/checkstyle/FileNameUtilTest.java
new file mode 100644 (file)
index 0000000..ffd5e9c
--- /dev/null
@@ -0,0 +1,21 @@
+package org.opendaylight.yangtools.checkstyle;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import org.junit.Test;
+
+public class FileNameUtilTest {
+
+    @Test
+    public void testFileNameUtil() {
+        File relativeFile = new File("src/main/java");
+        assertFalse(relativeFile.isAbsolute());
+        File absoluteFile = relativeFile.getAbsoluteFile();
+        assertTrue(absoluteFile.isAbsolute());
+        assertEquals("src/main/java", FileNameUtil.getOptionalPathRelativeToMavenProjectRoot(absoluteFile).get().getPath());
+    }
+
+}