add nanoseconds test case iso8601 parser
related to but does not fix
@@ -40,6 +40,7 @@ public class Iso8601ParserTest extends TestCase {
private Message mInvalidDate;
private Message mISOFormat;
private Message mNestedISOFormat;
+ private Message mNanosecondISOFormat;
private Message mMissingDate;
private OngoingStubbing<String> getTimestamp;
@@ -68,6 +69,10 @@ public class Iso8601ParserTest extends TestCase {
.getBytes("UTF-8");
mNestedISOFormat = new Message("test", 0, 0, null, nestedISOFormat);
+ byte nanosecondISOFormat[] = "{\"timestamp\":\"2006-01-02T23:59:59.999999999Z\"}"
+ .getBytes("UTF-8");
+ mNanosecondISOFormat = new Message("test", 0, 0, null, nanosecondISOFormat);
+
byte invalidDate[] = "{\"timestamp\":\"111-11111111\",\"id\":0,\"guid\":\"0436b17b-e78a-4e82-accf-743bf1f0b884\",\"isActive\":false,\"balance\":\"$3,561.87\",\"picture\":\"http://placehold.it/32x32\",\"age\":23,\"eyeColor\":\"green\",\"name\":\"Mercedes Brewer\",\"gender\":\"female\",\"company\":\"MALATHION\",\"email\":\"mercedesbrewer@malathion.com\",\"phone\":\"+1 (848) 471-3000\",\"address\":\"786 Gilmore Court, Brule, Maryland, 3200\",\"about\":\"Quis nostrud Lorem deserunt esse ut reprehenderit aliqua nisi et sunt mollit est. Cupidatat incididunt minim anim eiusmod culpa elit est dolor ullamco. Aliqua cillum eiusmod ullamco nostrud Lorem sit amet Lorem aliquip esse esse velit.\\r\\n\",\"registered\":\"2014-01-14T13:07:28 +08:00\",\"latitude\":47.672012,\"longitude\":102.788623,\"tags\":[\"amet\",\"amet\",\"dolore\",\"eu\",\"qui\",\"fugiat\",\"laborum\"],\"friends\":[{\"id\":0,\"name\":\"Rebecca Hardy\"},{\"id\":1,\"name\":\"Sutton Briggs\"},{\"id\":2,\"name\":\"Dena Campos\"}],\"greeting\":\"Hello, Mercedes Brewer! You have 7 unread messages.\",\"favoriteFruit\":\"strawberry\"}"
.getBytes("UTF-8");
mInvalidDate = new Message("test", 0, 0, null, invalidDate);
@@ -84,6 +89,7 @@ public class Iso8601ParserTest extends TestCase {
assertEquals("dt=2014-07-29", new Iso8601MessageParser(mConfig).extractPartitions(mFormat2)[0]);
assertEquals("dt=2001-07-04", new Iso8601MessageParser(mConfig).extractPartitions(mFormat3)[0]);
assertEquals("dt=2016-03-02", new Iso8601MessageParser(mConfig).extractPartitions(mFormat4)[0]);
+ assertEquals("dt=2006-01-02", new Iso8601MessageParser(mConfig).extractPartitions(mNanosecondISOFormat)[0]);
assertEquals("dt=1970-01-01", new Iso8601MessageParser(mConfig).extractPartitions(mInvalidDate)[0]);
assertEquals("dt=1970-01-01", new Iso8601MessageParser(mConfig).extractPartitions(mMissingDate)[0]);
}
