DoubleMatrix1DConverter implements ResultConverter<DoubleMatrix1D> { @Override public Map<String, Double> convert(String valueName, DoubleMatrix1D value) { Map<String, Double> returnValue = new HashMap<String, Double>(); double[] data = value.getData(); for (int i = 0; i < data.length; i++) { returnValue.put(valueName + "[" + i + "]", data[i]); } return returnValue; }  @Override Map<String, Double> convert(String valueName, DoubleMatrix1D value); @Override Class<?> getConvertedClass();  }
@Test public void convertEmpty() { Map<String, Double> expected = new HashMap<String, Double>(); Map<String, Double> actual = _converter.convert("Foo", new DoubleMatrix1D(new double[0])); assertEquals(expected, actual); }
@Test public void convertNonEmpty() { Map<String, Double> expected = new HashMap<String, Double>(); expected.put("Foo[0]", 5.5); expected.put("Foo[1]", 6.6); Map<String, Double> actual = _converter.convert("Foo", new DoubleMatrix1D(new double[] { 5.5, 6.6 })); assertEquals(expected, actual); }