### Question:
SizeValue { @Nonnull public static SizeValue percent(final int percentage) { return new SizeValue(percentage, SizeValueType.Percent); } SizeValue(@Nonnull final SizeValueType type);  SizeValue(final int value, @Nonnull final SizeValueType type);  SizeValue(@Nonnull final SizeValueType type, final int calculatedValue);  SizeValue(@Nullable final String valueParam); @Nonnull static SizeValue def(); @Nonnull static SizeValue def(final int pixelValue); @Nonnull static SizeValue px(final int pixelValue); @Nonnull static SizeValue percent(final int percentage); @Nonnull static SizeValue percentHeight(final int percentage); @Nonnull static SizeValue percentWidth(final int percentage); @Nonnull static SizeValue wildcard(); @Nonnull static SizeValue wildcard(final int computedValue); @Nonnull static SizeValue sum(); @Nonnull static SizeValue sum(final int computedValue); @Nonnull static SizeValue max(); @Nonnull static SizeValue max(final int computedValue); boolean isIndependentFromParent(); @Deprecated boolean isPercentOrPixel(); boolean hasValue(); float getValue(final float range); int getValueAsInt(final float range); String getValueAsString(); boolean isPixel(); boolean isPercent(); @Nonnull @Override String toString(); boolean hasDefault(); boolean hasWidthSuffix(); boolean hasHeightSuffix(); boolean hasWildcard(); boolean hasSum(); boolean hasMax(); @Override boolean equals(Object o); @Override int hashCode(); static final float MAX_PERCENT; }### Answer:
@Test public void testPercent() { SizeValue value = SizeValue.percent(10); assertEquals(100, value.getValueAsInt(1000.f)); assertEquals(10, value.getValueAsInt(100.f)); assertEquals(100.f, value.getValue(1000.f), 1.0e-7); assertEquals(10.f, value.getValue(100.f), 1.0e-7); assertTrue(value.hasValue()); assertTrue(value.isPercent()); assertFalse(value.isPixel()); assertFalse(value.isIndependentFromParent()); assertFalse(value.hasDefault()); assertFalse(value.hasWildcard()); assertFalse(value.hasMax()); assertFalse(value.hasSum()); assertFalse(value.hasHeightSuffix()); assertFalse(value.hasWidthSuffix()); }
@Test public void testPercentEquals() { SizeValue a = SizeValue.percent(10); SizeValue b = new SizeValue(10, SizeValueType.Percent); SizeValue c = new SizeValue("10%"); assertEquals(a, b); assertEquals(a, c); }
@Test public void testPercentFloatingPointEquals() { SizeValue a = SizeValue.percent(10); SizeValue b = new SizeValue("10.0%"); SizeValue c = new SizeValue("10%"); assertEquals(a, b); assertEquals(a, c); }
@Test public void testPercentFloatingPointNotEquals() { SizeValue a = SizeValue.percent(10); SizeValue b = new SizeValue("10.0001%"); SizeValue c = new SizeValue("10%"); SizeValue d = new SizeValue ("10.0002%"); assertNotEquals(a, b); assertNotEquals(b, c); assertNotEquals (b, d); assertNotEquals (c, d); assertNotEquals (a, d); }