Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from albert-so/master
[JENKINS-13599] Provided better implementation of DoxygenDirectoryParser#isDirectoryAbsolute().
- Loading branch information
Showing
2 changed files
with
66 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/java/hudson/plugins/doxygen/DoxygenDirectoryParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |