Get file last accessed time

Setup

private static final String SOURCE = "com/levelup/java/io/get-last-accessed-time.txt";

Path source;

@Before
public void setUp() throws IOException, URISyntaxException {

    source = Paths.get(this.getClass().getClassLoader().getResource(SOURCE)
            .toURI());
}

Straight up Java

@Test
public void file_last_accessed_time_nio () throws IOException {

    BasicFileAttributes attr = Files.readAttributes(source, BasicFileAttributes.class);

    FileTime lastAccessed = attr.lastAccessTime();
    
    assertEquals(1390446166000l, lastAccessed.toMillis());
}