@Test public void createClearingDocument() throws IOException { File targetFolder = folder.newFolder(); SW360Release release = SW360TestUtils.mkSW360Release("testRelease"); release.setOverriddenLicense("overridden"); Path clearingDocument = generator.createClearingDocument(release, targetFolder.toPath()); assertThat(Files.exists(clearingDocument)).isTrue(); assertThat(clearingDocument.getFileName().toString()).isEqualTo(release.getId() + "_clearing.json"); ObjectMapper mapper = new ObjectMapper(); mapper.readValue(clearingDocument.toFile(), SW360Release.class); String content = String.join("", Files.readAllLines(clearingDocument)); assertThat(content).contains(release.getDeclaredLicense()); assertThat(content).contains(release.getObservedLicense()); assertThat(content).contains(release.getOverriddenLicense()); System.out.println(content); }
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); } }    }