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

Commit 77d0e57

Browse files
committed
Update release notes wrt #74
1 parent d97c9c2 commit 77d0e57

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

release-notes/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Project: jackson-dataformat-csv
66

77
2.6.0 (not yet released)
88

9+
#74: Problems with ordering, `@JsonPropertyOrder` losing alphabetic ordering
910
- Removed type `CsvObjectReader`, sub-classing not needed at this point,
1011
just complicates handling (for now)
1112

src/test/java/com/fasterxml/jackson/dataformat/csv/failing/NullRead72Test.java

-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package com.fasterxml.jackson.dataformat.csv.failing;
22

3-
import java.io.ByteArrayOutputStream;
4-
import java.util.*;
5-
6-
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
73
import com.fasterxml.jackson.databind.*;
84
import com.fasterxml.jackson.dataformat.csv.*;
95

10-
import static org.junit.Assert.assertArrayEquals;
11-
126
public class NullRead72Test extends ModuleTestBase
137
{
148
final CsvMapper MAPPER = mapperForCsv();

src/test/java/com/fasterxml/jackson/dataformat/csv/failing/PropertyOrder74Test.java renamed to src/test/java/com/fasterxml/jackson/dataformat/csv/schema/PropertyOrder74Test.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.dataformat.csv.failing;
1+
package com.fasterxml.jackson.dataformat.csv.schema;
22

33
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
44

src/test/java/com/fasterxml/jackson/dataformat/csv/schema/SchemaTest.java

+28-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
88
import com.fasterxml.jackson.dataformat.csv.ModuleTestBase;
99
import com.fasterxml.jackson.dataformat.csv.CsvSchema.Column;
10+
import com.fasterxml.jackson.dataformat.csv.schema.PropertyOrder74Test.Point;
11+
import com.fasterxml.jackson.dataformat.csv.schema.PropertyOrder74Test.PointWithAnnotation;
1012

1113
public class SchemaTest extends ModuleTestBase
1214
{
@@ -22,16 +24,26 @@ static class ArrayWrapper {
2224
public List<String> c;
2325
}
2426

27+
// for [databind#74]
28+
static class Point {
29+
public int y;
30+
public int x;
31+
}
32+
33+
@JsonPropertyOrder()
34+
public static class PointWithAnnotation extends Point {}
35+
2536
/*
2637
/**********************************************************************
2738
/* Test methods
2839
/**********************************************************************
2940
*/
3041

42+
final CsvMapper MAPPER = mapperForCsv();
43+
3144
public void testUserWithTypedAutoSchema() throws Exception
3245
{
33-
CsvMapper mapper = mapperForCsv();
34-
CsvSchema schema = mapper.typedSchemaFor(FiveMinuteUser.class);
46+
CsvSchema schema = MAPPER.typedSchemaFor(FiveMinuteUser.class);
3547
assertEquals("[\"firstName\",\"lastName\",\"gender\",\"verified\",\"userImage\"]",
3648
schema.getColumnDesc());
3749
assertEquals(5, schema.size());
@@ -65,8 +77,7 @@ public void testUserWithTypedAutoSchema() throws Exception
6577

6678
public void testArrayWithTypedAutoSchema() throws Exception
6779
{
68-
CsvMapper mapper = mapperForCsv();
69-
CsvSchema schema = mapper.typedSchemaFor(ArrayWrapper.class);
80+
CsvSchema schema = MAPPER.typedSchemaFor(ArrayWrapper.class);
7081
assertEquals("[\"a\",\"b\",\"c\"]",
7182
schema.getColumnDesc());
7283
assertEquals(3, schema.size());
@@ -88,7 +99,7 @@ public void testArrayWithTypedAutoSchema() throws Exception
8899
_verifyLinks(schema);
89100
}
90101

91-
// for [Issue#42]
102+
// for [dataformat-csv#42]
92103
public void testReorderByName() throws Exception
93104
{
94105
CsvMapper mapper = mapperForCsv();
@@ -100,11 +111,10 @@ public void testReorderByName() throws Exception
100111
_verifyLinks(schema);
101112
}
102113

103-
// for [Issue#42]
114+
// for [dataformat-csv#42]
104115
public void testReorderWithComparator() throws Exception
105116
{
106-
CsvMapper mapper = mapperForCsv();
107-
CsvSchema schema = mapper.schemaFor(Mixed.class);
117+
CsvSchema schema = MAPPER.schemaFor(Mixed.class);
108118
schema = schema.sortedBy(Collections.<String>reverseOrder());
109119
assertEquals(aposToQuotes("['d','c','b','a']"), schema.getColumnDesc());
110120

@@ -125,4 +135,14 @@ private void _verifyLinks(CsvSchema schema)
125135
prev = curr;
126136
}
127137
}
138+
139+
// For [dataformat-csv#74]: problems applying default do-sort handling
140+
public void testSchemaWithOrdering() throws Exception
141+
{
142+
CsvSchema schema1 = MAPPER.schemaFor(Point.class);
143+
CsvSchema schema2 = MAPPER.schemaFor(PointWithAnnotation.class);
144+
145+
assertEquals(schema1.size(), schema2.size());
146+
assertEquals(schema1.column(0).getName(), schema2.column(0).getName());
147+
}
128148
}

0 commit comments

Comments
 (0)