Examples of Percentage


Examples of com.eclipsesource.tabris.passepartout.internal.unit.Percentage

    assertEquals( 50, height );
  }

  @Test
  public void testCalculatesHeightWithPercentageAndZeroParentBounds() {
    HeightInstruction instruction = new HeightInstruction( new Percentage( BigDecimal.valueOf( 50 ) ) );

    int height = instruction.computeHeight( new Bounds( 0, 0, 0, 0 ), 16 );

    assertEquals( 0, height );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.unit.Percentage

public class UnitUtilTest {

  @Test
  public void testCalculatesPercentage() {
    int pixel = UnitUtil.percentageToPixel( new Percentage( BigDecimal.TEN ), 100 );

    assertEquals( 10, pixel );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.unit.Percentage

    assertEquals( 10, pixel );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testCalculatesPercentageFailsWithNegativePercent() {
    UnitUtil.percentageToPixel( new Percentage( BigDecimal.TEN ), -100 );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.internal.unit.Percentage

    UnitUtil.emToPixel( new Em( BigDecimal.TEN ), -10 );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testCalculatesEmFailsWithWrongUnit() {
    UnitUtil.emToPixel( new Percentage( BigDecimal.TEN ), 10 );
  }
View Full Code Here

Examples of common.money.Percentage

   * @throws SQLException an exception occurred extracting data from the result set
   */
  private Beneficiary mapBeneficiary(ResultSet rs) throws SQLException {
    String name = rs.getString("BENEFICIARY_NAME");
    MonetaryAmount savings = MonetaryAmount.valueOf(rs.getString("BENEFICIARY_SAVINGS"));
    Percentage allocationPercentage = Percentage.valueOf(rs.getString("BENEFICIARY_ALLOCATION_PERCENTAGE"));
    return new Beneficiary(name, allocationPercentage, savings);
  }
View Full Code Here

Examples of org.apache.isis.applib.value.Percentage

                allowing(mockConfiguration).getString("isis.value.format.percentage");
                will(returnValue(null));
            }
        });

        percentage = new Percentage(0.105f);
        allowMockAdapterToReturn(percentage);

        holder = new FacetHolderImpl();

        setValue(adapter = new PercentageValueSemanticsProvider(holder, mockConfiguration, mockContext));
View Full Code Here

Examples of org.apache.isis.applib.value.Percentage

        assertEquals("0.105", encoded);
    }

    @Test
    public void testParseTextEntryWithNumber() {
        final Percentage parsed = adapter.parseTextEntry(percentage, "21%", null);
        assertEquals(new Percentage(0.21f), parsed);
    }
View Full Code Here

Examples of org.apache.isis.applib.value.Percentage

        assertEquals(new Percentage(0.21f), parsed);
    }

    @Test
    public void testParseTextEntryWithNumberAndDecimalPoint() {
        final Percentage parsed = adapter.parseTextEntry(percentage, "21.4%", null);
        assertEquals(new Percentage(0.214f), parsed);
    }
View Full Code Here

Examples of org.apache.isis.applib.value.Percentage

        assertEquals(new Percentage(0.214f), parsed);
    }

    @Test
    public void testParseTextEntryWithBlank() {
        final Percentage parsed = adapter.parseTextEntry(percentage, "", null);
        assertEquals(null, parsed);
    }
View Full Code Here

Examples of org.apache.isis.applib.value.Percentage

    }

    @Test
    public void testRestoreFromEncodedString() {
        final Object restored = adapter.fromEncodedString("0.2134");
        assertEquals(new Percentage(0.2134f), restored);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.