forked from phoedos/pmd
Fixed this JUnit test
Since it's a mocked class being reported on, it's reporting n/a for the file name. There's code in the PapariTextRenderer class that parses out the class name - based on substring of the File Separator parameter - On *Nix that's the / character. The test passes for me on both linux and Windows now git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5025 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -1,18 +1,22 @@
|
||||
package test.net.sourceforge.pmd.renderers;
|
||||
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.Report.ProcessingError;
|
||||
import net.sourceforge.pmd.renderers.AbstractRenderer;
|
||||
import net.sourceforge.pmd.renderers.PapariTextRenderer;
|
||||
import test.net.sourceforge.pmd.testframework.RuleTst;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
/*
|
||||
* Backing out this test - in progress
|
||||
*/
|
||||
public abstract class PapariTextRendererTest extends RuleTst /*AbstractRendererTst*/ {
|
||||
public class PapariTextRendererTest extends AbstractRendererTst {
|
||||
|
||||
private static String naString = "n/a";
|
||||
static {
|
||||
naString = naString.substring(naString.lastIndexOf(File.separator) + 1);
|
||||
}
|
||||
|
||||
public AbstractRenderer getRenderer() {
|
||||
return new PapariTextRenderer(){
|
||||
protected Reader getReader(String sourceFile) throws FileNotFoundException {
|
||||
@ -21,8 +25,8 @@ public abstract class PapariTextRendererTest extends RuleTst /*AbstractRendererT
|
||||
};
|
||||
}
|
||||
|
||||
/*TODO public String getExpected() {
|
||||
return "* file: n/a" + PMD.EOL + " src: n/a:1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + PMD.EOL + PMD.EOL + "Summary:" + PMD.EOL + PMD.EOL + " : 1" + PMD.EOL + "* warnings: 1" + PMD.EOL;
|
||||
public String getExpected() {
|
||||
return "* file: n/a" + PMD.EOL + " src: " + naString + ":1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + PMD.EOL + PMD.EOL + "Summary:" + PMD.EOL + PMD.EOL + " : 1" + PMD.EOL + "* warnings: 1" + PMD.EOL;
|
||||
}
|
||||
|
||||
public String getExpectedEmpty() {
|
||||
@ -30,10 +34,10 @@ public abstract class PapariTextRendererTest extends RuleTst /*AbstractRendererT
|
||||
}
|
||||
|
||||
public String getExpectedMultiple() {
|
||||
return "* file: n/a" + PMD.EOL + " src: n/a:1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + " src: n/a:1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + PMD.EOL + PMD.EOL + "Summary:" + PMD.EOL + PMD.EOL + " : 2" + PMD.EOL + "* warnings: 2" + PMD.EOL;
|
||||
return "* file: n/a" + PMD.EOL + " src: " + naString + ":1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + " src: " + naString + ":1:1" + PMD.EOL + " rule: Foo" + PMD.EOL + " msg: msg" + PMD.EOL + " code: public class Foo {}" + PMD.EOL + PMD.EOL + PMD.EOL + PMD.EOL + "Summary:" + PMD.EOL + PMD.EOL + " : 2" + PMD.EOL + "* warnings: 2" + PMD.EOL;
|
||||
}
|
||||
|
||||
public String getExpectedError(ProcessingError error) {
|
||||
return PMD.EOL + PMD.EOL + "Summary:" + PMD.EOL + PMD.EOL + " err: Error" + PMD.EOL + PMD.EOL + "* errors: 0" + PMD.EOL + "* warnings: 0" + PMD.EOL;
|
||||
}
|
||||
*/}
|
||||
}
|
||||
|
Reference in New Issue
Block a user