@Test public void secondJsonObjectsInResultArrayEqualsSecondElementOfList() { JsonObject result = buildJsonObject(4, false); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression.get(1).getExperimentAccession(), isA(String.class)); assertThat(expression.get(1).getBioentityId(), isA(String.class)); assertThat(expression.get(1).getSpecies(), isA(String.class)); assertThat(expression.get(1).getExpression().getPValue(), isA(Double.class)); assertThat(expression.get(1).getExpression().getFoldChange(), isA(Double.class)); }
public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for (JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if (Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (JsonParseException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array", e); } }
DifferentialJsonResultsParser extends JsonExceptionHandlingController { public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for (JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if (Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (JsonParseException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array", e); } } }
DifferentialJsonResultsParser extends JsonExceptionHandlingController { public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for (JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if (Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (JsonParseException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array", e); } } @Inject  DifferentialJsonResultsParser(ContrastTrader contrastTrader); }
DifferentialJsonResultsParser extends JsonExceptionHandlingController { public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for (JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if (Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (JsonParseException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array", e); } } @Inject  DifferentialJsonResultsParser(ContrastTrader contrastTrader); ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj); }
DifferentialJsonResultsParser extends JsonExceptionHandlingController { public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for (JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if (Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (JsonParseException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array", e); } } @Inject  DifferentialJsonResultsParser(ContrastTrader contrastTrader); ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj);  }