@Test
  public void testWriteDate() throws Exception {
    DateTime d = new DateTime(1991, 10, 11, 0, 0);
    pigValueRangeTest("junitTypeTest1", "date", "datetime", null, d.toString(),
        d.toString(FORMAT_4_DATE), FORMAT_4_DATE);
    pigValueRangeTestOverflow("junitTypeTest2", "date", "datetime",
        HCatBaseStorer.OOR_VALUE_OPT_VALUES.Null, d.plusHours(2).toString(), FORMAT_4_DATE);// time
                                                                                            // != 0
    pigValueRangeTestOverflow("junitTypeTest3", "date", "datetime",
        HCatBaseStorer.OOR_VALUE_OPT_VALUES.Throw, d.plusMinutes(1).toString(), FORMAT_4_DATE);// time
                                                                                               // !=
                                                                                               // 0
    d = new DateTime(1991, 10, 11, 0, 0, DateTimeZone.forOffsetHours(-11));
    pigValueRangeTest("junitTypeTest4", "date", "datetime", null, d.toString(),
        d.toString(FORMAT_4_DATE), FORMAT_4_DATE);
    pigValueRangeTestOverflow("junitTypeTest5", "date", "datetime",
        HCatBaseStorer.OOR_VALUE_OPT_VALUES.Null, d.plusHours(2).toString(), FORMAT_4_DATE);// date
                                                                                            // out
                                                                                            // of
                                                                                            // range
                                                                                            // due
                                                                                            // to
                                                                                            // time
                                                                                            // != 0
    pigValueRangeTestOverflow("junitTypeTest6", "date", "datetime",
        HCatBaseStorer.OOR_VALUE_OPT_VALUES.Throw, d.plusMinutes(1).toString(), FORMAT_4_DATE);// date
                                                                                               // out
                                                                                               // of
                                                                                               // range
                                                                                               // due
                                                                                               // to
                                                                                               // time!=0
  }
because we want to ignore TZ which is included in toString() include time to make sure it's 0
hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/AbstractHCatStorerTest.java