### Question:
RestServerEndpoint implements AutoCloseableAsync { @VisibleForTesting static void createUploadDir(final Path uploadDir, final Logger log) throws IOException { if (!Files.exists(uploadDir)) { log.warn("Upload directory {} does not exist, or has been deleted externally. " + "Previously uploaded files are no longer available.", uploadDir); checkAndCreateUploadDir(uploadDir, log); } } RestServerEndpoint(RestServerEndpointConfiguration configuration); final void start(); @Nullable InetSocketAddress getServerAddress(); String getRestBaseUrl(); @Override CompletableFuture<Void> closeAsync();  }### Answer:
@Test public void testCreateUploadDir() throws Exception { final File file = temporaryFolder.newFolder(); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER); assertTrue(Files.exists(testUploadDir)); }
@Test public void testCreateUploadDirFails() throws Exception { final File file = temporaryFolder.newFolder(); Assume.assumeTrue(file.setWritable(false)); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); try { RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER); fail("Expected exception not thrown."); } catch (IOException e) { } }