3737 */
3838public class FileTimesTest {
3939
40- public static Stream <Arguments > dateToNtfsProvider () {
41- // @formatter:off
42- return Stream .of (
43- Arguments .of ("1601-01-01T00:00:00.000Z" , 0 ),
44- Arguments .of ("1601-01-01T00:00:00.000Z" , 1 ),
45- Arguments .of ("1600-12-31T23:59:59.999Z" , -1 ),
46- Arguments .of ("+30828-09-14T02:48:05.477580700Z" , Long .MAX_VALUE ),
47- Arguments .of ("-27627-04-19T21:11:54.522419200Z" , Long .MIN_VALUE ),
48- Arguments .of ("1601-01-01T00:00:00.001Z" , FileTimes .HUNDRED_NANOS_PER_MILLISECOND ),
49- Arguments .of ("1601-01-01T00:00:00.001Z" , FileTimes .HUNDRED_NANOS_PER_MILLISECOND + 1 ),
50- Arguments .of ("1601-01-01T00:00:00.000Z" , FileTimes .HUNDRED_NANOS_PER_MILLISECOND - 1 ),
51- Arguments .of ("1600-12-31T23:59:59.999Z" , -FileTimes .HUNDRED_NANOS_PER_MILLISECOND ),
52- Arguments .of ("1600-12-31T23:59:59.999Z" , -FileTimes .HUNDRED_NANOS_PER_MILLISECOND + 1 ),
53- Arguments .of ("1600-12-31T23:59:59.998Z" , -FileTimes .HUNDRED_NANOS_PER_MILLISECOND - 1 ),
54- Arguments .of ("1970-01-01T00:00:00.000Z" , -FileTimes .UNIX_TO_NTFS_OFFSET ),
55- Arguments .of ("1970-01-01T00:00:00.000Z" , -FileTimes .UNIX_TO_NTFS_OFFSET + 1 ),
56- Arguments .of ("1970-01-01T00:00:00.001Z" , -FileTimes .UNIX_TO_NTFS_OFFSET + FileTimes .HUNDRED_NANOS_PER_MILLISECOND ),
57- Arguments .of ("1969-12-31T23:59:59.999Z" , -FileTimes .UNIX_TO_NTFS_OFFSET - 1 ),
58- Arguments .of ("1969-12-31T23:59:59.999Z" , -FileTimes .UNIX_TO_NTFS_OFFSET - FileTimes .HUNDRED_NANOS_PER_MILLISECOND ));
59- // @formatter:on
60- }
61-
6240 public static Stream <Arguments > fileTimeNanoUnitsToNtfsProvider () {
6341 // @formatter:off
6442 return Stream .of (
@@ -103,7 +81,7 @@ public static Stream<Arguments> isUnixFileTimeProvider() {
10381 }
10482
10583 @ ParameterizedTest
106- @ MethodSource ("dateToNtfsProvider " )
84+ @ MethodSource ("fileTimeNanoUnitsToNtfsProvider " )
10785 public void testDateToFileTime (final String instant , final long ignored ) {
10886 final Instant parsedInstant = Instant .parse (instant );
10987 final FileTime parsedFileTime = FileTime .from (parsedInstant );
@@ -112,7 +90,7 @@ public void testDateToFileTime(final String instant, final long ignored) {
11290 }
11391
11492 @ ParameterizedTest
115- @ MethodSource ("dateToNtfsProvider " )
93+ @ MethodSource ("fileTimeNanoUnitsToNtfsProvider " )
11694 public void testDateToNtfsTime (final String instant , final long ntfsTime ) {
11795 final long ntfsMillis = Math .floorDiv (ntfsTime , FileTimes .HUNDRED_NANOS_PER_MILLISECOND ) * FileTimes .HUNDRED_NANOS_PER_MILLISECOND ;
11896 final Date parsed = Date .from (Instant .parse (instant ));
@@ -152,7 +130,7 @@ public void testFileTimeToNtfsTime(final String instant, final long ntfsTime) {
152130 }
153131
154132 @ ParameterizedTest
155- @ MethodSource ("dateToNtfsProvider " )
133+ @ MethodSource ("fileTimeNanoUnitsToNtfsProvider " )
156134 public void testFromUnixTime (final String instant , final long ntfsTime ) {
157135 final long epochSecond = Instant .parse (instant ).getEpochSecond ();
158136 assertEquals (epochSecond , FileTimes .fromUnixTime (epochSecond ).to (TimeUnit .SECONDS ));
0 commit comments