This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Description
Follow-up to #42
It seems the implementation only sorts the columns in headers, not actual values.
I have a test for 2.6.3
public void testValueReorderByName() throws Exception
{
CsvMapper mapper = mapperForCsv();
CsvSchema schema = mapper.schemaFor(Mixed.class);
assertEquals(aposToQuotes("['a','b','c','d']"), schema.getColumnDesc());
schema = schema.sortedBy("b", "c");
assertEquals(aposToQuotes("['b','c','a','d']"), schema.getColumnDesc());
Mixed value = new Mixed();
value.a = 1;
value.b = 2;
value.c = 3;
value.d = 4;
schema = schema.withHeader();
String outputString = mapper.writer(schema).writeValueAsString(Arrays.asList(value));
assertThat(outputString, is(equalTo("b,c,a,d\n2,3,1,4\n")));
_verifyLinks(schema);
}
test output:
java.lang.AssertionError:
Expected: is "b,c,a,d\n2,3,1,4\n"
but: was "b,c,a,d\n1,2,3,4\n"