Files { public static Path tempFile() { String tempDir = System.getProperty("java.io.tmpdir"); return Paths.get(tempDir + "/" + UUID.randomUUID().toString() + ".tmp"); }  static String text(Path file); static byte[] bytes(Path file); static void createDir(Path directory); static void deleteDir(Path directory); static Path tempFile(); static Path tempDir(); static void delete(Path file); static long size(Path file); static Instant lastModified(Path file);  }
@Test void tempFile() throws IOException { Path file = Files.tempFile(); assertThat(file.getFileName().toString()).endsWith(".tmp"); java.nio.file.Files.write(file, Strings.bytes("test")); assertThat(Files.size(file)).isEqualTo(4); assertThat(Files.lastModified(file)).isNotNull(); assertThat(Files.text(file)).isEqualTo("test"); Files.delete(file); }