@@ -128,6 +128,38 @@ public void testPojo2() throws Exception {
128
128
assertRoundTrip (value , TestPojo2 .class );
129
129
}
130
130
131
+ @ Test
132
+ public void testPojo2WithTimestamp () throws Exception {
133
+ String value = "{" +
134
+ "raw_value:2017-05-25T15:33:08Z," +
135
+ "raw_sexp:(this that)," +
136
+ "wrapped_sexp:{sexp:(other)}," +
137
+ "}" ;
138
+
139
+ TestPojo2 t = ionValueMapper .parse (ionSystem .singleValue (value ), TestPojo2 .class );
140
+ assertEquals (ionSystem .singleValue ("2017-05-25T15:33:08Z" ), t .rawValue );
141
+ assertEquals (ionSystem .singleValue ("(this that)" ), t .rawSexp );
142
+ assertEquals (ionSystem .singleValue ("(other)" ), t .wrappedSexp .sexp );
143
+
144
+ assertRoundTrip (value , TestPojo2 .class );
145
+ }
146
+
147
+ @ Test
148
+ public void testPojo2WithBlob () throws Exception {
149
+ String value = "{" +
150
+ "raw_value:{{YmxvYl92YWx1ZQ==}}," +
151
+ "raw_sexp:(this that)," +
152
+ "wrapped_sexp:{sexp:(other)}," +
153
+ "}" ;
154
+
155
+ TestPojo2 t = ionValueMapper .parse (ionSystem .singleValue (value ), TestPojo2 .class );
156
+ assertEquals (ionSystem .newBlob ("blob_value" .getBytes ()), t .rawValue );
157
+ assertEquals (ionSystem .singleValue ("(this that)" ), t .rawSexp );
158
+ assertEquals (ionSystem .singleValue ("(other)" ), t .wrappedSexp .sexp );
159
+
160
+ assertRoundTrip (value , TestPojo2 .class );
161
+ }
162
+
131
163
/**
132
164
* This Pojo supports open content
133
165
*/
@@ -154,12 +186,16 @@ public void testPojo3WithOpenContent() throws Exception {
154
186
"expected:1," +
155
187
"something_unexpected:(boo!)," +
156
188
"another_random_struct:{yikes:scared}," +
189
+ "timestamp_att:2021-02-15T18:40:40Z," +
190
+ "blob_att:{{YmxvYl92YWx1ZQ==}}," +
157
191
"}" ;
158
192
159
193
TestPojo3 t = ionValueMapper .parse (ionSystem .singleValue (value ), TestPojo3 .class );
160
194
assertEquals (1 , t .expected );
161
195
assertEquals (ionSystem .singleValue ("(boo!)" ), t .any ().get ("something_unexpected" ));
162
196
assertEquals (ionSystem .singleValue ("{yikes:scared}" ), t .any ().get ("another_random_struct" ));
197
+ assertEquals (ionSystem .singleValue ("2021-02-15T18:40:40Z" ), t .any ().get ("timestamp_att" ));
198
+ assertEquals (ionSystem .newBlob ("blob_value" .getBytes ()), t .any ().get ("blob_att" ));
163
199
164
200
assertRoundTrip (value , TestPojo3 .class );
165
201
}
0 commit comments