FileManDateTimeFormat { public static PointInTime parsePointInTime(String text) { return parse(text); } protected  FileManDateTimeFormat(); static DateTimeFormatter date(); static DateTimeFormatter time(); static DateTimeFormatter dateTime(); static PointInTimeFormatter pointInTimeParser(); static PointInTime parse(String text); static PointInTime toPointInTime(String text); static PointInTime parsePointInTime(String text); static LocalDateTime parseLocalDateTime(String text);  }
@Test public void testParsePointInTime() { PointInTime t = FileManDateTimeFormat.parse("2750000"); Assert.assertEquals(Precision.YEAR, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); t = FileManDateTimeFormat.parse("2750700"); Assert.assertEquals(Precision.MONTH, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonth()); t = FileManDateTimeFormat.parse("2750723"); Assert.assertEquals(Precision.DATE, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(23, t.getDate()); t = FileManDateTimeFormat.parse("2750723.15"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(23, t.getDate()); Assert.assertEquals(15, t.getHour()); Assert.assertEquals(0, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2750723.1057"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(23, t.getDate()); Assert.assertEquals(10, t.getHour()); Assert.assertEquals(57, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2750723.105713"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(23, t.getDate()); Assert.assertEquals(10, t.getHour()); Assert.assertEquals(57, t.getMinute()); Assert.assertEquals(13, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2981118.071"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1998, t.getYear()); Assert.assertEquals(11, t.getMonth()); Assert.assertEquals(18, t.getDate()); Assert.assertEquals(7, t.getHour()); Assert.assertEquals(10, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2970711.07171"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1997, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(11, t.getDate()); Assert.assertEquals(7, t.getHour()); Assert.assertEquals(17, t.getMinute()); Assert.assertEquals(10, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2990121.1"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1999, t.getYear()); Assert.assertEquals(1, t.getMonth()); Assert.assertEquals(21, t.getDate()); Assert.assertEquals(10, t.getHour()); Assert.assertEquals(0, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2990121.10"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1999, t.getYear()); Assert.assertEquals(1, t.getMonth()); Assert.assertEquals(21, t.getDate()); Assert.assertEquals(10, t.getHour()); t = FileManDateTimeFormat.parse("2990121.100"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1999, t.getYear()); Assert.assertEquals(1, t.getMonth()); Assert.assertEquals(21, t.getDate()); Assert.assertEquals(10, t.getHour()); Assert.assertEquals(0, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2750000.0"); Assert.assertEquals(Precision.YEAR, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); t = FileManDateTimeFormat.parse("2750000.000"); Assert.assertEquals(Precision.YEAR, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); t = FileManDateTimeFormat.parse("2981118.070"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1998, t.getYear()); Assert.assertEquals(11, t.getMonth()); Assert.assertEquals(18, t.getDate()); Assert.assertEquals(7, t.getHour()); Assert.assertEquals(0, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2970711.07170"); Assert.assertEquals(Precision.MILLISECOND, t.getPrecision()); Assert.assertEquals(1997, t.getYear()); Assert.assertEquals(7, t.getMonth()); Assert.assertEquals(11, t.getDate()); Assert.assertEquals(7, t.getHour()); Assert.assertEquals(17, t.getMinute()); Assert.assertEquals(0, t.getSecond()); Assert.assertEquals(0, t.getMillisecond()); t = FileManDateTimeFormat.parse("2750000.00000"); Assert.assertEquals(Precision.YEAR, t.getPrecision()); Assert.assertEquals(1975, t.getYear()); }