Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
issue-128 : Reformat tabs to spaces
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Ansell <[email protected]>
  • Loading branch information
ansell committed Aug 22, 2016
1 parent 6637c03 commit fa79ad4
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public class HeaderWriteTest extends ModuleTestBase
public void testNoLines() throws Exception
{
List<String> headers = Arrays.asList("TestHeader1", "TestHeader2");
List<List<String>> dataSource = Arrays.asList();
String result = runTest(headers, dataSource);
assertEquals("Headers should have been written even with no other data", "TestHeader1,TestHeader2\n", result);
List<List<String>> dataSource = Arrays.asList();
String result = runTest(headers, dataSource);
assertEquals("Headers should have been written even with no other data", "TestHeader1,TestHeader2\n", result);
}

public void testOneLine() throws Exception
{
List<String> headers = Arrays.asList("TestHeader1", "TestHeader2");
List<List<String>> dataSource = Arrays.asList(Arrays.asList("TestValue1", "TestValue2"));
String result = runTest(headers, dataSource);
assertEquals("Headers should have been written before line", "TestHeader1,TestHeader2\nTestValue1,TestValue2\n", result);
List<List<String>> dataSource = Arrays.asList(Arrays.asList("TestValue1", "TestValue2"));
String result = runTest(headers, dataSource);
assertEquals("Headers should have been written before line", "TestHeader1,TestHeader2\nTestValue1,TestValue2\n", result);
}

private String runTest(List<String> headers, List<List<String>> dataSource) throws IOException
Expand All @@ -48,14 +48,14 @@ private String runTest(List<String> headers, List<List<String>> dataSource) thro

CsvSchema schema = builder.setUseHeader(true).build();
try (SequenceWriter csvWriter = MAPPER.writerWithDefaultPrettyPrinter()
.with(schema)
.forType(List.class)
.writeValues(writer);) {
.with(schema)
.forType(List.class)
.writeValues(writer);) {
for(List<String> nextRow : dataSource) {
csvWriter.write(nextRow);
csvWriter.write(nextRow);
}
}

return writer.toString();
return writer.toString();
}
}

0 comments on commit fa79ad4

Please sign in to comment.