()
| 73 | public final TemporaryFolder temporaryFolder = new TemporaryFolder(); |
| 74 | |
| 75 | @Test |
| 76 | public void testAllocate() throws Exception { |
| 77 | assertMemoryLeak(() -> { |
| 78 | File temp = temporaryFolder.newFile(); |
| 79 | TestUtils.writeStringToFile(temp, "abcde"); |
| 80 | try (Path path = new Path().of(temp.getAbsolutePath())) { |
| 81 | Assert.assertTrue(Files.exists(path.$())); |
| 82 | Assert.assertEquals(5, Files.length(path.$())); |
| 83 | |
| 84 | long fd = Files.openRW(path.$()); |
| 85 | try { |
| 86 | Files.allocate(fd, 10); |
| 87 | Assert.assertEquals(10, Files.length(path.$())); |
| 88 | Files.allocate(fd, 120); |
| 89 | Assert.assertEquals(120, Files.length(path.$())); |
| 90 | } finally { |
| 91 | Files.close(fd); |
| 92 | } |
| 93 | } |
| 94 | }); |
| 95 | } |
| 96 | |
| 97 | @Test |
| 98 | public void testAllocateConcurrent() throws IOException, InterruptedException { |
nothing calls this directly
no test coverage detected