@Test public void trueFalseOrStringValue() throws Exception { final JsonQueryResult jqr = new JsonQueryResult("TrueFalse"); SeriesHandler handler = new SeriesHandler(); jqr.getQueryResult() .getResults() .stream() .flatMap(result -> result.getSeries().stream()) .forEach(handler::addSeries); final List<TimeSeriesCollection> handlerResult = handler.build().collect(Collectors.toList()); assertThat(handlerResult, Matchers.contains(Matchers.allOf( Matchers.hasProperty("timestamp", Matchers.equalTo(new DateTime(0, DateTimeZone.UTC))), Matchers.hasProperty("TSValues", Matchers.containsInAnyOrder( new ImmutableTimeSeriesValue(GroupName.valueOf("string"), singletonMap(MetricName.valueOf("foobar"), MetricValue.fromStrValue("a string"))), new ImmutableTimeSeriesValue(GroupName.valueOf("true"), singletonMap(MetricName.valueOf("foobar"), MetricValue.TRUE)), new ImmutableTimeSeriesValue(GroupName.valueOf("false"), singletonMap(MetricName.valueOf("foobar"), MetricValue.FALSE)) )) ))); }
public Stream<TimeSeriesCollection> build() { return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new DatumsIterator(datums.entrySet().iterator()), DatumsIterator.SPLITERATOR_CHARACTERISTICS), false); }
SeriesHandler { public Stream<TimeSeriesCollection> build() { return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new DatumsIterator(datums.entrySet().iterator()), DatumsIterator.SPLITERATOR_CHARACTERISTICS), false); } }
SeriesHandler { public Stream<TimeSeriesCollection> build() { return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new DatumsIterator(datums.entrySet().iterator()), DatumsIterator.SPLITERATOR_CHARACTERISTICS), false); }  }
SeriesHandler { public Stream<TimeSeriesCollection> build() { return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new DatumsIterator(datums.entrySet().iterator()), DatumsIterator.SPLITERATOR_CHARACTERISTICS), false); }  Stream<TimeSeriesCollection> build(); void addSeries(QueryResult.Series series); void merge(SeriesHandler other); }
SeriesHandler { public Stream<TimeSeriesCollection> build() { return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new DatumsIterator(datums.entrySet().iterator()), DatumsIterator.SPLITERATOR_CHARACTERISTICS), false); }  Stream<TimeSeriesCollection> build(); void addSeries(QueryResult.Series series); void merge(SeriesHandler other);  }