@Test public void testCompareTo() { NumberHolder[] array = { new NumberHolder(new BigDecimal("999")), new NumberHolder(new BigDecimal("777")), new NumberHolder(new BigDecimal("0.0000")), new NumberHolder(new BigDecimal("-20.00")), new NumberHolder(null), new NumberHolder(new BigDecimal("0")),}; BigDecimal[] expectedResult = { null, new BigDecimal("-20.00"), new BigDecimal("0.0000"), new BigDecimal("0"), new BigDecimal("777"), new BigDecimal("999") }; Arrays.sort(array); for (int i = 0; i < array.length; i++) { BigDecimal value = array[i].getValue(); BigDecimal expected = expectedResult[i]; assertEquals(expected, value); } }
@Override public BigDecimal getValue() { return value; }
NumberHolder extends AbstractValueHolder { @Override public BigDecimal getValue() { return value; } }
NumberHolder extends AbstractValueHolder { @Override public BigDecimal getValue() { return value; } NumberHolder(BigDecimal value); }
NumberHolder extends AbstractValueHolder { @Override public BigDecimal getValue() { return value; } NumberHolder(BigDecimal value); @Override BigDecimal getValue(); @Override BigDecimal getBigDecimal(); @Override int intValue(); @Override long longValue(); @Override double doubleValue(); @Override Double getDouble(); @Override Integer getInteger(); @Override Long getLong(); @Override String getString(); }
NumberHolder extends AbstractValueHolder { @Override public BigDecimal getValue() { return value; } NumberHolder(BigDecimal value); @Override BigDecimal getValue(); @Override BigDecimal getBigDecimal(); @Override int intValue(); @Override long longValue(); @Override double doubleValue(); @Override Double getDouble(); @Override Integer getInteger(); @Override Long getLong(); @Override String getString();  }