Github user shubham-pathak22 commented on a diff in the pull request:
https://github.com/apache/apex-malhar/pull/348#discussion_r72049665
--- Diff:
library/src/test/java/com/datatorrent/lib/formatter/JsonFormatterTest.java ---
@@ -182,14 +173,19 @@ public void testJSONToPOJONoFieldPOJO()
Assert.assertEquals(0, validDataSink.collectedTuples.size());
Assert.assertEquals(1, invalidDataSink.collectedTuples.size());
Assert.assertEquals(o, invalidDataSink.collectedTuples.get(0));
+ Assert.assertEquals(1, operator.getIncomingTuplesCount());
+ Assert.assertEquals(0, operator.getEmittedObjectCount());
+ Assert.assertEquals(1, operator.getErrorTupleCount());
}
public static class Test1Pojo
{
public int a;
public long b;
+ @JsonProperty("c2")
public String c;
public List<String> d;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd")
--- End diff --
1. By default Date object is written as time in millis. Had added the test
for it, it passes on local machine but getting build failures when I check in
the code. Hence in the test case, I have formated the date values to limit to
year, month and day
2. There is no annotation for time field. Time field in the POJO is written
as "time in millis". Faced similar issue with the test case as above.
3. Have added multiple patterns. Locally I have tested with "timezone"
fields as well and it works. Again, locally the test case passes but fails
after checking it in.
4.
http://fasterxml.github.io/jackson-annotations/javadoc/2.1.0/com/fasterxml/jackson/annotation/JsonFormat.Shape.html
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---