Skip to content
Permalink
Browse files

[JENKINS-13599] Provided better implementation of

DoxygenDirectoryParser#isDirectoryAbsolute(). The previous implementation would
incorrectly think that doc was absolute because java.io.File found /home/y/doc
  • Loading branch information
Albert So
Albert So committed Apr 25, 2012
1 parent f14d86f commit 78e416c86cf0679e8f305679cdc48b1a6f74170c
Showing with 31 additions and 0 deletions.
  1. +31 −0 src/test/java/hudson/plugins/doxygen/DoxygenDirectoryParserTest.java
@@ -0,0 +1,31 @@
package hudson.plugins.doxygen;

import org.junit.Test;

import junit.framework.Assert;

public class DoxygenDirectoryParserTest {

@Test
public void testIsAbsolute() throws Exception {
DoxygenDirectoryParser parser = new DoxygenDirectoryParser("", "", "");
// testData array contains arrays of test data where index 0 is the path
// and index 1 is the expectedResult of isAbsolute
// This test data will currently on work in a Unix environment
System.out.println(System.getProperty("user.dir"));
Object[][] testData = new Object[][] {
{ "doc", false },
{ "/usr", true },
{ "abcd123", false }, // nonexistent relative dir
{ "/foo/bar", true }, // nonexistent absolute dir
{ "/etc/passwd", true },
{ "pom.xml", false }, // since tests are run from the trunk dir
{ "src", false }, // a dir in the trunk dir
};

for(Object[] testPair : testData ) {
Boolean actual = parser.isDirectoryAbsolute((String)testPair[0]);
Assert.assertEquals("For path:" + testPair[0], (Boolean)testPair[1], actual);
}
}
}

0 comments on commit 78e416c

Please sign in to comment.
You can’t perform that action at this time.