### Question:
Quantities { public static QuantitativeAmount of( BigDecimal amount, Unit unit ){ return new QuantitativeAmount(amount, unit.getName()); }  static QuantitativeAmount of( BigDecimal amount, Unit unit ); static QuantitativeAmount of( BigDecimal amount, UnitName unitName ); static QuantitativeAmount of( BigDecimal amount, String unitName ); static QuantitativeAmount convert( QuantitativeAmount quantity, UnitName unitName ); static QuantitativeAmount add( QuantitativeAmount x, BigDecimal amount ); static QuantitativeAmount add( QuantitativeAmount x, QuantitativeAmount y ); static QuantitativeAmount add( QuantitativeAmount x, QuantitativeAmount y, UnitName unitName ); static QuantitativeAmount subtract( QuantitativeAmount x, BigDecimal amount ); static QuantitativeAmount subtract( QuantitativeAmount x, QuantitativeAmount y ); static QuantitativeAmount subtract( QuantitativeAmount x, QuantitativeAmount y, UnitName unitName ); static QuantitativeAmount multiply( QuantitativeAmount x, BigDecimal amount ); static QuantitativeAmount multiply( QuantitativeAmount x, QuantitativeAmount y ); static QuantitativeAmount multiply( QuantitativeAmount x, QuantitativeAmount y, UnitName unitName ); static QuantitativeAmount divide( QuantitativeAmount base, BigDecimal amount ); static QuantitativeAmount divide( QuantitativeAmount x, QuantitativeAmount y ); static QuantitativeAmount divide( QuantitativeAmount x, QuantitativeAmount y, UnitName unitName );  }### Answer:
@Test public void testOf_BigDecimal_Unit() { System.out.println("of"); BigDecimal amount = BigDecimal.TEN; Unit unit = new Unit( GRAM, new QuantitativeAmount(BigDecimal.ONE, GRAM )); QuantitativeAmount expResult = new QuantitativeAmount(BigDecimal.TEN, GRAM); QuantitativeAmount result = Quantities.of(amount, unit); assertEquals(expResult, result); }
@Test public void testOf_BigDecimal_UnitName() { System.out.println("of"); BigDecimal amount = BigDecimal.TEN; UnitName unitName = UnitName.of("MASS:GRAM"); QuantitativeAmount expResult = new QuantitativeAmount(BigDecimal.TEN, GRAM); QuantitativeAmount result = Quantities.of(amount, unitName); assertEquals(expResult, result); }
@Test public void testOf_BigDecimal_String() { System.out.println("of"); BigDecimal amount = BigDecimal.TEN; String unitName = "MASS:GRAM"; QuantitativeAmount expResult = new QuantitativeAmount(BigDecimal.TEN, GRAM); QuantitativeAmount result = Quantities.of(amount, unitName); assertEquals(expResult, result); }