@Test public void testMissingFolderIsCreated() throws IOException { Path root = folder.newFolder().toPath(); Path nonExistingFolder = root.resolve("non/existing/folder"); SW360Release release = SW360TestUtils.mkSW360Release("create"); Path clearingDocument = generator.createClearingDocument(release, nonExistingFolder); assertThat(Files.exists(clearingDocument)).isTrue(); }
Path createClearingDocument(SW360Release release, Path targetDir) { Path clearingDocument = targetDir.resolve(release.getId() + CLEARING_DOC_SUFFIX); try { Files.createDirectories(targetDir); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(Files.newBufferedWriter(clearingDocument), release); return clearingDocument; } catch (IOException e) { throw new SW360ClientException("Could not create clearing document " + clearingDocument.toString(), e); } }
ClearingReportGenerator { Path createClearingDocument(SW360Release release, Path targetDir) { Path clearingDocument = targetDir.resolve(release.getId() + CLEARING_DOC_SUFFIX); try { Files.createDirectories(targetDir); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(Files.newBufferedWriter(clearingDocument), release); return clearingDocument; } catch (IOException e) { throw new SW360ClientException("Could not create clearing document " + clearingDocument.toString(), e); } } }
ClearingReportGenerator { Path createClearingDocument(SW360Release release, Path targetDir) { Path clearingDocument = targetDir.resolve(release.getId() + CLEARING_DOC_SUFFIX); try { Files.createDirectories(targetDir); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(Files.newBufferedWriter(clearingDocument), release); return clearingDocument; } catch (IOException e) { throw new SW360ClientException("Could not create clearing document " + clearingDocument.toString(), e); } }  }
ClearingReportGenerator { Path createClearingDocument(SW360Release release, Path targetDir) { Path clearingDocument = targetDir.resolve(release.getId() + CLEARING_DOC_SUFFIX); try { Files.createDirectories(targetDir); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(Files.newBufferedWriter(clearingDocument), release); return clearingDocument; } catch (IOException e) { throw new SW360ClientException("Could not create clearing document " + clearingDocument.toString(), e); } }   }
ClearingReportGenerator { Path createClearingDocument(SW360Release release, Path targetDir) { Path clearingDocument = targetDir.resolve(release.getId() + CLEARING_DOC_SUFFIX); try { Files.createDirectories(targetDir); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(Files.newBufferedWriter(clearingDocument), release); return clearingDocument; } catch (IOException e) { throw new SW360ClientException("Could not create clearing document " + clearingDocument.toString(), e); } }    }