@Test public void testValidAbsoluteExpression() { LengthExpression classUnderTest = new LengthExpression("123.45px"); assertEquals(123.45f, classUnderTest.getLength(800), DELTA); assertEquals(123.45f, classUnderTest.getLength(1000), DELTA); }
public float getLength(float screenSize) { if (type == ExpressionType.PERCENTAGE) { return (value / 100) * screenSize; } return value; }
LengthExpression { public float getLength(float screenSize) { if (type == ExpressionType.PERCENTAGE) { return (value / 100) * screenSize; } return value; } }
LengthExpression { public float getLength(float screenSize) { if (type == ExpressionType.PERCENTAGE) { return (value / 100) * screenSize; } return value; } LengthExpression(String expression); }
LengthExpression { public float getLength(float screenSize) { if (type == ExpressionType.PERCENTAGE) { return (value / 100) * screenSize; } return value; } LengthExpression(String expression); float getLength(float screenSize); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
LengthExpression { public float getLength(float screenSize) { if (type == ExpressionType.PERCENTAGE) { return (value / 100) * screenSize; } return value; } LengthExpression(String expression); float getLength(float screenSize); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }