@Test
 public void testLength() {
   Quantity<Length> l =
       DefaultQuantityFactory.getInstance(Length.class).create(23.5, METRE); // 23.0 km
   assertEquals(Double.valueOf(23.5d), l.getValue());
   assertEquals(METRE, l.getUnit());
   assertEquals("m", l.getUnit().getSymbol());
 }
 @Test
 @Ignore
 public void testMass() {
   Quantity<Mass> m = DefaultQuantityFactory.getInstance(Mass.class).create(10, KILOGRAM); // 10 kg
   assertEquals(Integer.valueOf(10), m.getValue());
   assertEquals(KILOGRAM, m.getUnit());
   assertEquals("kg", m.getUnit().getSymbol());
   assertEquals("10 kg", m.toString());
 }
 @Test
 public void testTime() {
   Quantity<Time> t = DefaultQuantityFactory.getInstance(Time.class).create(40, MINUTE); // 40 min
   assertEquals(Integer.valueOf(40), t.getValue());
   assertEquals(MINUTE, t.getUnit());
   assertNull(t.getUnit().getSymbol());
   //		assertEquals("s", t.getUnit().getSymbol()); // FIXME this should be "min", tweak for
   // TransformedUnit
   assertEquals("40 min", t.toString());
 }
  /** @param args */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public static void main(String[] args) {
    Quantity<Length> length = Quantities.getQuantity(10, SI.METRE);
    // LengthAmount length = new LengthAmount(10, SI.KILOGRAM);
    // this won't work ;-)

    System.out.println(length);
    Unit<Length> lenUnit = length.getUnit();
    System.out.println(lenUnit);

    System.out.println(((AbstractQuantity) length).doubleValue(USCustomary.FOOT));
    // System.out.println(length.doubleValue(USCustomary.POUND));
    // this won't work either.
    // UnitConverter footConv = lenUnit.getConverterTo(USCustomary.INCH);
    System.out.print(((AbstractQuantity<Length>) length).doubleValue(USCustomary.INCH));
    System.out.println(" " + USCustomary.FOOT);

    Quantity<Mass> mass = Quantities.getQuantity(1000, SI.GRAM);
    Quantity<Mass> mass2 = NumberQuantity.of(1, SI.KILOGRAM);
    System.out.println(mass.equals(mass2));
  }
 @Test
 public void testOf() {
   Quantity<Pressure> pressure = Quantities.getQuantity(BigDecimal.ONE, PASCAL);
   assertEquals(PASCAL, pressure.getUnit());
 }