@Test public void testMappingAdditionalInformationForLicenses() 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(ObservedLicenseInformation.class)).isEmpty(); assertThat(artifacts.get(0).askFor(MissingLicenseInformation.class).get().getMissingLicenseReasons()) .containsExactlyInAnyOrder(MissingLicenseReasons.NO_LICENSE_IN_SOURCES); }
@SuppressWarnings("WeakerAccess") protected List<Artifact> createArtifactsList(InputStream stream, List<String> filterStrings) { LOGGER.debug("Create artifacts list from input stream."); List<Artifact> artifacts = new ArrayList<>(); List<JsonObject> objects = readJsonObjects(stream); for (JsonObject obj : objects) { if (filterObject(obj, Optional.ofNullable(filterStrings))) { continue; } Artifact artifact = mapArtifact(obj); artifacts.add(artifact); } LOGGER.debug("Creation of artifacts list finished."); try { stream.close(); } catch (IOException e) { LOGGER.debug("Failed to close stream. Ignored."); } return artifacts; }
JsonReader { @SuppressWarnings("WeakerAccess") protected List<Artifact> createArtifactsList(InputStream stream, List<String> filterStrings) { LOGGER.debug("Create artifacts list from input stream."); List<Artifact> artifacts = new ArrayList<>(); List<JsonObject> objects = readJsonObjects(stream); for (JsonObject obj : objects) { if (filterObject(obj, Optional.ofNullable(filterStrings))) { continue; } Artifact artifact = mapArtifact(obj); artifacts.add(artifact); } LOGGER.debug("Creation of artifacts list finished."); try { stream.close(); } catch (IOException e) { LOGGER.debug("Failed to close stream. Ignored."); } return artifacts; } }
JsonReader { @SuppressWarnings("WeakerAccess") protected List<Artifact> createArtifactsList(InputStream stream, List<String> filterStrings) { LOGGER.debug("Create artifacts list from input stream."); List<Artifact> artifacts = new ArrayList<>(); List<JsonObject> objects = readJsonObjects(stream); for (JsonObject obj : objects) { if (filterObject(obj, Optional.ofNullable(filterStrings))) { continue; } Artifact artifact = mapArtifact(obj); artifacts.add(artifact); } LOGGER.debug("Creation of artifacts list finished."); try { stream.close(); } catch (IOException e) { LOGGER.debug("Failed to close stream. Ignored."); } return artifacts; } JsonReader(Path recordingFile, Path dependencyDir, Charset encoding); }
JsonReader { @SuppressWarnings("WeakerAccess") protected List<Artifact> createArtifactsList(InputStream stream, List<String> filterStrings) { LOGGER.debug("Create artifacts list from input stream."); List<Artifact> artifacts = new ArrayList<>(); List<JsonObject> objects = readJsonObjects(stream); for (JsonObject obj : objects) { if (filterObject(obj, Optional.ofNullable(filterStrings))) { continue; } Artifact artifact = mapArtifact(obj); artifacts.add(artifact); } LOGGER.debug("Creation of artifacts list finished."); try { stream.close(); } catch (IOException e) { LOGGER.debug("Failed to close stream. Ignored."); } return artifacts; } JsonReader(Path recordingFile, Path dependencyDir, Charset encoding); List<Artifact> createArtifactsList(InputStream is); }
JsonReader { @SuppressWarnings("WeakerAccess") protected List<Artifact> createArtifactsList(InputStream stream, List<String> filterStrings) { LOGGER.debug("Create artifacts list from input stream."); List<Artifact> artifacts = new ArrayList<>(); List<JsonObject> objects = readJsonObjects(stream); for (JsonObject obj : objects) { if (filterObject(obj, Optional.ofNullable(filterStrings))) { continue; } Artifact artifact = mapArtifact(obj); artifacts.add(artifact); } LOGGER.debug("Creation of artifacts list finished."); try { stream.close(); } catch (IOException e) { LOGGER.debug("Failed to close stream. Ignored."); } return artifacts; } JsonReader(Path recordingFile, Path dependencyDir, Charset encoding); List<Artifact> createArtifactsList(InputStream is);  }