CurrencyValue implements CellValue { public static CurrencyValue from(final Object o, final String currency) throws FastOdsException { if (o instanceof Number) { return new CurrencyValue((Number) o, currency); } else if (o instanceof CurrencyValue) { final CurrencyValue currencyValue = (CurrencyValue) o; return new CurrencyValue(currencyValue.value, currency); } else { throw new FastOdsException("Can't cast " + o + " to Currency"); } } CurrencyValue(final Number value, final String currency); static CurrencyValue from(final Object o, final String currency); @Override void setToCell(final TableCell tableCell); @Override boolean equals(final Object o); @Override final int hashCode();  }
@Test public void testFromCurrencyValue() throws FastOdsException { final CurrencyValue cv1 = CurrencyValue.from(16, "€"); final CurrencyValue cv2 = CurrencyValue.from(cv1, "$"); Assert.assertEquals(new CurrencyValue(16, "$"), cv2); }
@Test(expected = FastOdsException.class) public void testFromObject() throws FastOdsException { CurrencyValue.from(new Object(), "€"); }