use of com.googlecode.jslint4java.JSLintResult in project jslint4java by happygiraffe.
the class JUnitXmlFormatterTest method testNoProblems.
@Test
public void testNoProblems() throws Exception {
String expected = "<testsuite failures=\"0\" time=\"0.000\" errors=\"0\" skipped=\"0\" " + "tests=\"1\" name=\"hello.js\">" + "<testcase time=\"0.000\" classname=\"com.googlecode.jslint4java\" name=\"hello.js\" />" + "</testsuite>";
JSLintResult result = new JSLintResult.ResultBuilder("hello.js").duration(0).build();
XMLAssert.assertXMLEqual(expected, form.format(result));
}
use of com.googlecode.jslint4java.JSLintResult in project jslint4java by happygiraffe.
the class JUnitXmlFormatterTest method testTwoProblems.
// Just to get the coverage scores up…
@Test
public void testTwoProblems() throws Exception {
String expected = "<testsuite failures=\"1\" time=\"0.000\" errors=\"1\" skipped=\"0\" " + "tests=\"1\" name=\"hello.js\">" + "<testcase time=\"0.000\" classname=\"com.googlecode.jslint4java\" name=\"hello.js\">" + "<failure message=\"Found 2 problems\" type=\"java.lang.AssertionError\">" + "hello.js:1:1:too many aardvarks\n" + "hello.js:1:2:too few aardvarks\n" + "</failure>" + "</testcase>" + "</testsuite>";
String name = "hello.js";
Issue issue1 = new Issue.IssueBuilder(name, 1, 1, "too many aardvarks").build();
Issue issue2 = new Issue.IssueBuilder(name, 1, 2, "too few aardvarks").build();
JSLintResult result = new JSLintResult.ResultBuilder(name).duration(0).addIssue(issue1).addIssue(issue2).build();
XMLAssert.assertXMLEqual(expected, form.format(result));
}
use of com.googlecode.jslint4java.JSLintResult in project jslint4java by happygiraffe.
the class PlainFormatterTest method testExpectedOutputNoIssues.
@Test
public void testExpectedOutputNoIssues() {
JSLintResult result = new JSLintResult.ResultBuilder("foo/bar.js").build();
String out = rf.format(result);
assertThat(out, is(""));
}
use of com.googlecode.jslint4java.JSLintResult in project jslint4java by happygiraffe.
the class PlainFormatterTest method testNoEvidence.
/**
* When there's no evidence, we shouldn't print a blank line or a caret.
*/
@Test
public void testNoEvidence() throws Exception {
String nl = System.getProperty("line.separator");
String name = "foo/bar.js";
Issue issue = new IssueBuilder(name, 1, 1, "fatality").build();
JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
StringBuilder sb = new StringBuilder(name);
sb.append(":1:1: fatality");
sb.append(nl);
assertThat(rf.format(result), is(sb.toString()));
}
use of com.googlecode.jslint4java.JSLintResult in project jslint4java by happygiraffe.
the class PlainFormatterTest method testExpectedOutputOneIssue.
@Test
public void testExpectedOutputOneIssue() {
String nl = System.getProperty("line.separator");
String name = "foo/bar.js";
Issue issue = new IssueBuilder(name, 1, 2, "no clucking").evidence("cluck()").build();
JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
StringBuilder sb = new StringBuilder(name);
sb.append(":1:2: no clucking").append(nl);
sb.append("cluck()").append(nl);
sb.append(" ^").append(nl);
assertThat(rf.format(result), is(sb.toString()));
}
Aggregations