()
| 97 | } |
| 98 | |
| 99 | @Test |
| 100 | public void testDateTimeWritables() throws IOException { |
| 101 | Configuration jobConf = new Configuration(); |
| 102 | |
| 103 | DateTimeWritable.setupAvailableZoneIds(); |
| 104 | UDFContext.getUDFContext().addJobConf(jobConf); |
| 105 | |
| 106 | String[] testZones = new String[]{"America/Los_Angeles", "Europe/London", "Europe/Budapest", "Japan"}; |
| 107 | |
| 108 | DateTime testInputBase = DateTime.now(); |
| 109 | for (String zoneId : testZones){ |
| 110 | DateTimeZone customTZ = DateTimeZone.forID(zoneId); |
| 111 | //Test with timezone name as zone ID |
| 112 | testDateTimeForZone(new DateTime(testInputBase).withZoneRetainFields(customTZ)); |
| 113 | //Test with offset as zone ID |
| 114 | testDateTimeForZone(new DateTime(testInputBase, DateTimeZone.forOffsetMillis(customTZ.getOffset(testInputBase)))); |
| 115 | } |
| 116 | |
| 117 | } |
| 118 | |
| 119 | private void testDateTimeForZone(DateTime testIn) throws IOException { |
| 120 | DateTimeWritable in = new DateTimeWritable(testIn); |
nothing calls this directly
no test coverage detected