JsonReader { private LicenseInformation mapLicenses(String identifier, JsonObject licenseDataObj) { if (null != licenseDataObj) { JsonArray objs = (JsonArray) licenseDataObj.get(identifier); if (null != objs) { Spliterator<Object> tmp = objs.spliterator(); Collection<String> licenses = StreamSupport.stream(tmp, false) .map(obj -> (JsonObject) obj) .map(obj -> (String) obj.get("licenseId")) .filter(licenseId -> !SPECIAL_INFORMATION.containsKey(licenseId)) .collect(Collectors.toSet()); return LicenseSupport.mapLicenses(licenses); } } return new LicenseStatement(); } JsonReader(Path recordingFile, Path dependencyDir, Charset encoding); List<Artifact> createArtifactsList(InputStream is);  }
@Test public void testMapLicenses() throws URISyntaxException, IOException { Path recordFilePath = Paths.get(".", "target", "foo"); JsonReader jsonReader = new JsonReader(recordFilePath, Paths.get("tmp"), StandardCharsets.UTF_8); URI uri = this.getClass().getClassLoader().getResource("JsonReaderTest/data.json").toURI(); InputStream iStream = Files.newInputStream(Paths.get(uri)); artifacts = jsonReader.createArtifactsList(iStream); assertThat(artifacts.get(0).askForGet(DeclaredLicenseInformation.class).get().evaluate()).isEqualTo("( license1 AND license2 AND license3 )"); }