### Question:
Files { public static File writeFileToDirectory(InputStream in, String path) throws IOException { String tempName = UUID.randomUUID().toString().replaceAll("-", ""); File tempFile = new File(path, tempName + ".tmp"); if (tempFile.createNewFile()) if (in == null) { return tempFile; } try (FileOutputStream tempOS = new FileOutputStream(tempFile)) { byte[] buf = new byte[1024]; int i = in.read(buf); while (i != -1) { tempOS.write(buf, 0, i); i = in.read(buf); } } finally { in.close(); } return tempFile; } private  Files(); static File writeToTemp(InputStream in); static File writeFileToDirectory(InputStream in, String path); static final String JAVA_IO_TMP_DIR; static final String TEMP_DIR; }### Answer:
@Test public void writeFileToDirectory() { try { Files.writeFileToDirectory(new ByteArrayInputStream("asd".getBytes("UTF-8")), "/"); Assert.fail("should be throw exception"); } catch (IOException e) { Assert.assertTrue(e.getMessage() != null); } }