RedirectWriter { public void write(String reportUrl) throws AETException { boolean directoryExists = tryCreateDirectory(); if (directoryExists) { File file = new File(getTargetPath()); try { Files.write(getContent(reportUrl), file, Charsets.UTF_8); } catch (IOException e) { throw new AETException("Failed to create: " + FILE_NAME, e); } } else { throw new AETException("Failed to create directory: " + buildDirectory); } } RedirectWriter(String buildDirectory); void write(String reportUrl);  }
@Test public void writeTest() throws AETException { tested.write(REPORT_URL); assertThat(getTargetFile().exists(), is(true)); }