Example #1
0
 @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());
 }
Example #2
0
 @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());
 }
Example #3
0
 @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());
 }