Move tests for specific issues to own package
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1742173 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
20eac694a0
commit
9ab47dc56b
|
@ -383,32 +383,6 @@ public class CSVFormatTest {
|
||||||
Assert.assertTrue(formatWithHeader.getHeader().length == 0);
|
Assert.assertTrue(formatWithHeader.getHeader().length == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testJiraCsv154_withCommentMarker() throws IOException {
|
|
||||||
final String comment = "This is a header comment";
|
|
||||||
final CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withCommentMarker('#').withHeaderComments(comment);
|
|
||||||
final StringBuilder out = new StringBuilder();
|
|
||||||
final CSVPrinter printer = format.print(out);
|
|
||||||
printer.print("A");
|
|
||||||
printer.print("B");
|
|
||||||
printer.close();
|
|
||||||
final String s = out.toString();
|
|
||||||
Assert.assertTrue(s, s.contains(comment));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testJiraCsv154_withHeaderComments() throws IOException {
|
|
||||||
final String comment = "This is a header comment";
|
|
||||||
final CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withHeaderComments(comment).withCommentMarker('#');
|
|
||||||
final StringBuilder out = new StringBuilder();
|
|
||||||
final CSVPrinter printer = format.print(out);
|
|
||||||
printer.print("A");
|
|
||||||
printer.print("B");
|
|
||||||
printer.close();
|
|
||||||
final String s = out.toString();
|
|
||||||
Assert.assertTrue(s, s.contains(comment));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithIgnoreEmptyLines() throws Exception {
|
public void testWithIgnoreEmptyLines() throws Exception {
|
||||||
assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
|
assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.apache.commons.csv.bugs;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.commons.csv.CSVFormat;
|
||||||
|
import org.apache.commons.csv.CSVPrinter;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class JiraCsv164Test {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testJiraCsv154_withCommentMarker() throws IOException {
|
||||||
|
final String comment = "This is a header comment";
|
||||||
|
final CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withCommentMarker('#').withHeaderComments(comment);
|
||||||
|
final StringBuilder out = new StringBuilder();
|
||||||
|
final CSVPrinter printer = format.print(out);
|
||||||
|
printer.print("A");
|
||||||
|
printer.print("B");
|
||||||
|
printer.close();
|
||||||
|
final String s = out.toString();
|
||||||
|
assertTrue(s, s.contains(comment));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testJiraCsv154_withHeaderComments() throws IOException {
|
||||||
|
final String comment = "This is a header comment";
|
||||||
|
final CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withHeaderComments(comment).withCommentMarker('#');
|
||||||
|
final StringBuilder out = new StringBuilder();
|
||||||
|
final CSVPrinter printer = format.print(out);
|
||||||
|
printer.print("A");
|
||||||
|
printer.print("B");
|
||||||
|
printer.close();
|
||||||
|
final String s = out.toString();
|
||||||
|
assertTrue(s, s.contains(comment));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.csv;
|
package org.apache.commons.csv.bugs;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -22,6 +22,10 @@ import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import org.apache.commons.csv.CSVFormat;
|
||||||
|
import org.apache.commons.csv.CSVParser;
|
||||||
|
import org.apache.commons.csv.CSVRecord;
|
||||||
|
import org.apache.commons.csv.QuoteMode;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
Loading…
Reference in New Issue