TimeSeriesConverter implements ResultConverter<DoubleTimeSeries<?>> { @Override public Map<String, Double> convert(String valueName, DoubleTimeSeries<?> value) { Map<String, Double> returnValue = new HashMap<String, Double>(); for (Map.Entry<?, Double> point : value) { String key = valueName + "[" + point.getKey().toString() + "]"; returnValue.put(key, point.getValue()); } return returnValue; }  @Override Map<String, Double> convert(String valueName, DoubleTimeSeries<?> value); @Override Class<?> getConvertedClass();  }
@Test public void convertEmpty() { Map<String, Double> expected = new HashMap<String, Double>(); Map<String, Double> actual = _converter.convert("Foo", ImmutableLocalDateDoubleTimeSeries.EMPTY_SERIES); assertEquals(expected, actual); }
@Test public void convertNonEmpty() { Map<String, Double> expected = new HashMap<String, Double>(); expected.put("Foo[2005-04-04]", 5.5); expected.put("Foo[2005-04-05]", 6.6); Map<String, Double> actual = _converter.convert("Foo", ImmutableLocalDateDoubleTimeSeries.of( new LocalDate[] { LocalDate.of(2005, 4, 4), LocalDate.of(2005, 4, 5) }, new double[] { 5.5, 6.6 })); assertEquals(expected, actual); }