PercentageValue implements CellValue { public static PercentageValue from(final Object o) throws FastOdsException { if (o instanceof Number) { return new PercentageValue(((Number) o).floatValue()); } else if (o instanceof PercentageValue) { return (PercentageValue) o; } else { throw new FastOdsException("Can't cast " + o + " to Percentage"); } } PercentageValue(final double value); static PercentageValue from(final Object o); @Override void setToCell(final TableCell tableCell); @Override boolean equals(final Object o); @Override final int hashCode();  }
@Test public void testFromPercentageValue() throws FastOdsException { final PercentageValue cv1 = PercentageValue.from(0.25); final PercentageValue cv2 = PercentageValue.from(cv1); Assert.assertEquals(cv1, cv2); }
@Test(expected = FastOdsException.class) public void testFromObject() throws FastOdsException { PercentageValue.from(new Object()); }