|
12 | 12 | import org.joda.time.format.ISODateTimeFormat; |
13 | 13 |
|
14 | 14 | import java.io.IOException; |
| 15 | +import java.util.Random; |
15 | 16 |
|
16 | 17 | public class JodaSerializationTest extends JodaTestBase |
17 | 18 | { |
@@ -248,4 +249,47 @@ public void testCustomYearMonthSer() throws Exception |
248 | 249 | String json = MAPPER.writeValueAsString(new FormattedYearMonth(yearMonth)); |
249 | 250 | assertEquals(a2q("{'value':'2013/08'}"), json); |
250 | 251 | } |
| 252 | + |
| 253 | + public void testHoursSer() throws Exception |
| 254 | + { |
| 255 | + Hours hours = Hours.hours(1); |
| 256 | + String json = MAPPER.writeValueAsString(hours); |
| 257 | + assertEquals("1", json); |
| 258 | + } |
| 259 | + |
| 260 | + public void testMinutesSer() throws Exception |
| 261 | + { |
| 262 | + Minutes minutes = Minutes.minutes(2); |
| 263 | + String json = MAPPER.writeValueAsString(minutes); |
| 264 | + assertEquals("2", json); |
| 265 | + } |
| 266 | + |
| 267 | + public void testSecondsSer() throws Exception |
| 268 | + { |
| 269 | + Seconds seconds = Seconds.seconds(3); |
| 270 | + String json = MAPPER.writeValueAsString(seconds); |
| 271 | + assertEquals("3", json); |
| 272 | + } |
| 273 | + |
| 274 | + public void testMonthsSer() throws Exception |
| 275 | + { |
| 276 | + Months months = Months.months(4); |
| 277 | + String json = MAPPER.writeValueAsString(months); |
| 278 | + assertEquals("4", json); |
| 279 | + } |
| 280 | + |
| 281 | + public void testYearsSer() throws Exception |
| 282 | + { |
| 283 | + Years years = Years.years(5); |
| 284 | + String json = MAPPER.writeValueAsString(years); |
| 285 | + assertEquals("5", json); |
| 286 | + } |
| 287 | + |
| 288 | + public void testWeeksSer() throws Exception |
| 289 | + { |
| 290 | + Weeks weeks = Weeks.weeks(6); |
| 291 | + String json = MAPPER.writeValueAsString(weeks); |
| 292 | + assertEquals("6", json); |
| 293 | + } |
| 294 | + |
251 | 295 | } |
0 commit comments