LabelledMatrix1D { public LabelledMatrix1D<S, T> add(final LabelledMatrix1D<S, T> other) { return add(other, getDefaultTolerance()); } LabelledMatrix1D(final S[] keys, final double[] values, final T defaultTolerance);  LabelledMatrix1D(final S[] keys, final Object[] labels, final double[] values, final T defaultTolerance);  LabelledMatrix1D(final S[] keys, final String labelsTitle, final double[] values, final String valuesTitle, final T defaultTolerance);  LabelledMatrix1D(final S[] keys, final Object[] labels, final String labelsTitle, final double[] values, final String valuesTitle, final T defaultTolerance); S[] getKeys(); Object[] getLabels(); String getLabelsTitle(); double[] getValues(); String getValuesTitle(); int size(); LabelledMatrix1D<S, T> addIgnoringLabel(final LabelledMatrix1D<S, T> other); LabelledMatrix1D<S, T> addIgnoringLabel(final LabelledMatrix1D<S, T> other, final T tolerance); LabelledMatrix1D<S, T> add(final LabelledMatrix1D<S, T> other); LabelledMatrix1D<S, T> add(final LabelledMatrix1D<S, T> other, final T tolerance); LabelledMatrix1D<S, T> addIgnoringLabel(final S key, final Object label, final double value); LabelledMatrix1D<S, T> addIgnoringLabel(final S key, final Object label, final double value, final T tolerance); LabelledMatrix1D<S, T> add(final S key, final Object label, final double value); LabelledMatrix1D<S, T> add(final S key, final Object label, final double value, final T tolerance); T getDefaultTolerance(); abstract int compare(S key1, S key2, T tolerance); int compare(final S key1, final S key2); abstract LabelledMatrix1D<S, T> getMatrix(S[] keys, Object[] labels, String labelsTitle, double[] values, String valuesTitle); abstract LabelledMatrix1D<S, T> getMatrix(S[] keys, Object[] labels, double[] values); abstract LabelledMatrix1D<S, T> getMatrix(S[] keys, double[] values); @Override int hashCode(); @Override boolean equals(Object obj); LabelledMatrix1D<S, T> divideBy(double amountToDivideBy);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddSingleValueWrongLabel1() { M1.add(1., "12M", 0.1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddSingleValueWrongLabel2() { M1.add(1. + HIGH_TOLERANCE / 2, "12M", 0.1, HIGH_TOLERANCE); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddNullMatrix2() { M1.add(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddWithWrongLabel() { final int n = TIMES3.length; final Double[] times = Arrays.copyOf(TIMES3, n); final Object[] labels = Arrays.copyOf(LABELS3, n); labels[3] = "7D"; final double[] values = Arrays.copyOf(VALUES3, n); final LabelledMatrix1D<Double, Double> m = new DoubleLabelledMatrix1D(times, labels, values); M1.add(m); }