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

Commit

Permalink
Update release notes wrt #74
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 25, 2015
1 parent d97c9c2 commit 77d0e57
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Project: jackson-dataformat-csv

2.6.0 (not yet released)

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
package com.fasterxml.jackson.dataformat.csv.failing;

import java.io.ByteArrayOutputStream;
import java.util.*;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.dataformat.csv.*;

import static org.junit.Assert.assertArrayEquals;

public class NullRead72Test extends ModuleTestBase
{
final CsvMapper MAPPER = mapperForCsv();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.dataformat.csv.failing;
package com.fasterxml.jackson.dataformat.csv.schema;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
import com.fasterxml.jackson.dataformat.csv.ModuleTestBase;
import com.fasterxml.jackson.dataformat.csv.CsvSchema.Column;
import com.fasterxml.jackson.dataformat.csv.schema.PropertyOrder74Test.Point;
import com.fasterxml.jackson.dataformat.csv.schema.PropertyOrder74Test.PointWithAnnotation;

public class SchemaTest extends ModuleTestBase
{
Expand All @@ -22,16 +24,26 @@ static class ArrayWrapper {
public List<String> c;
}

// for [databind#74]
static class Point {
public int y;
public int x;
}

@JsonPropertyOrder()
public static class PointWithAnnotation extends Point {}

/*
/**********************************************************************
/* Test methods
/**********************************************************************
*/

final CsvMapper MAPPER = mapperForCsv();

public void testUserWithTypedAutoSchema() throws Exception
{
CsvMapper mapper = mapperForCsv();
CsvSchema schema = mapper.typedSchemaFor(FiveMinuteUser.class);
CsvSchema schema = MAPPER.typedSchemaFor(FiveMinuteUser.class);
assertEquals("[\"firstName\",\"lastName\",\"gender\",\"verified\",\"userImage\"]",
schema.getColumnDesc());
assertEquals(5, schema.size());
Expand Down Expand Up @@ -65,8 +77,7 @@ public void testUserWithTypedAutoSchema() throws Exception

public void testArrayWithTypedAutoSchema() throws Exception
{
CsvMapper mapper = mapperForCsv();
CsvSchema schema = mapper.typedSchemaFor(ArrayWrapper.class);
CsvSchema schema = MAPPER.typedSchemaFor(ArrayWrapper.class);
assertEquals("[\"a\",\"b\",\"c\"]",
schema.getColumnDesc());
assertEquals(3, schema.size());
Expand All @@ -88,7 +99,7 @@ public void testArrayWithTypedAutoSchema() throws Exception
_verifyLinks(schema);
}

// for [Issue#42]
// for [dataformat-csv#42]
public void testReorderByName() throws Exception
{
CsvMapper mapper = mapperForCsv();
Expand All @@ -100,11 +111,10 @@ public void testReorderByName() throws Exception
_verifyLinks(schema);
}

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

Expand All @@ -125,4 +135,14 @@ private void _verifyLinks(CsvSchema schema)
prev = curr;
}
}

// For [dataformat-csv#74]: problems applying default do-sort handling
public void testSchemaWithOrdering() throws Exception
{
CsvSchema schema1 = MAPPER.schemaFor(Point.class);
CsvSchema schema2 = MAPPER.schemaFor(PointWithAnnotation.class);

assertEquals(schema1.size(), schema2.size());
assertEquals(schema1.column(0).getName(), schema2.column(0).getName());
}
}

0 comments on commit 77d0e57

Please sign in to comment.