### Question:
FileAgent implements IFileAgent { @Override public void writeCache(String key, byte[] data) throws IOException { if (cache == null) { return; } if (key == null) { return; } if (data == null) { return; } ensureCacheDirExists(); Path cacheFile = cache.resolve(key); try { Files.write(cacheFile, data); } catch (IOException e) { } } FileAgent(final Path root, final Path cache); @Override File getRoot(); @Override void writeCache(String key, byte[] data); @Override byte[] readCache(String key);  }### Answer:
@Test public void testCacheFolderNotExists() throws IOException { assertFalse(Files.exists(cache)); String data = RandomStringUtils.random(1000); fileAgent.writeCache("testKey", data.getBytes()); assertTrue(Files.exists(cache)); assertTrue(Files.exists(cache.resolve("testKey"))); }