package com.googlecode.jslint4java.ant;

import com.googlecode.jslint4java.Issue;
import com.googlecode.jslint4java.Issue.IssueBuilder;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

public class PlainResultFormatterTest {

    private final PlainResultFormatter rf = new PlainResultFormatter();
    private final List<Issue> issues = new ArrayList<Issue>();
    private final ByteArrayOutputStream out = new ByteArrayOutputStream();

    /**
     *  Run the formatter over the current set of issues.  The File as input
     * is just a convenient way of passing a name & path together.
     */
    private void runFormatter(File file) {
        rf.begin();
        rf.output(file.getName(), file.toString(), issues);
        rf.end();
    }

    @Before
    public void setUpOutputStream() {
        rf.setOut(out);
    }

    @Test
    public void testExpectedOutputNoIssues() {
        File file = new File("foo/bar.js");
        runFormatter(file);
        assertThat(out.size(), is(0));
    }

    @Test
    public void testExpectedOutputOneIssue() {
        File file = new File("foo/bar.js");
        Issue issue = new IssueBuilder(file.getName(), 1, 1, "no clucking").evidence("cluck()").build();
        issues.add(issue);
        runFormatter(file);
        String expected = "bar.js:1:1:no clucking\ncluck()\n^\n";
        // NB: We use platform encoding here, as that's what we expect the
        // formatter to produce.
        assertThat(out.toString(), is(expected));
    }

}

@@ -45,96 +45,79 @@
 ort 
-com.googlecode.jslint4java.Issue;%0Aimport com.googlecode.jslint4java.Issue.IssueBuilder
+static org.hamcrest.CoreMatchers.*;%0Aimport static org.junit.Assert.*
 ;%0A
+%0A
 impo
@@ -218,24 +218,25 @@
 .util.List;%0A
+%0A
 import org.j
@@ -275,83 +275,102 @@
 st;%0A
+%0A
 import 
-static org.junit.Assert.*;%0Aimport static org.hamcrest.CoreMatchers.*
+com.googlecode.jslint4java.Issue;%0Aimport com.googlecode.jslint4java.Issue.IssueBuilder
 ;%0A%0Ap
@@ -634,17 +634,16 @@
 *%0A     *
- 
  Run the
@@ -684,17 +684,16 @@
  issues.
- 
  The Fil
@@ -706,18 +706,18 @@
 nput
+ is
 %0A     *
- is
  jus
@@ -1275,32 +1275,32 @@
 (%22foo/bar.js%22);%0A
-
         Issue is
@@ -1358,16 +1358,33 @@
 ucking%22)
+%0A                
 .evidenc

Format in eclipse.