### Question:
Dimensions { public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; }  static ObservableList<Item> getList(final Type dimType); static int getIndex(final Type dimType, Dim dimension); static double convert(double value, Dim fromDimention, Dim toDimention);  }### Answer:
@Test public void testTime() throws Exception { double out; out = Dimensions.convert(60.0, Dimensions.Dim.SEC, Dimensions.Dim.MINUTE); assertTrue(Math.abs(out - 1.0) < 0.0001); out = Dimensions.convert(3600.0, Dimensions.Dim.SEC, Dimensions.Dim.HOUR); assertTrue(Math.abs(out - 1.0) < 0.0001); }
@Test public void testDistance() throws Exception { double out; out = Dimensions.convert(1.0, Dimensions.Dim.CM, Dimensions.Dim.DEC); assertTrue(Math.abs(out - 0.1) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.FOOT, Dimensions.Dim.CM); assertTrue(Math.abs(out - 30.48) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.INCH, Dimensions.Dim.CM); assertTrue(Math.abs(out - 2.54) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.INCH, Dimensions.Dim.FOOT); assertTrue(Math.abs(out - 0.08333333333333333) < 0.0001); }
@Test public void testVelocity() throws Exception { double out; out = Dimensions.convert(60.0, Dimensions.Dim.MM_MINUTE, Dimensions.Dim.MM_SEC); assertTrue(Math.abs(out - 1.0) < 0.0001); out = Dimensions.convert(25.4, Dimensions.Dim.MM_SEC, Dimensions.Dim.INCH_SEC); assertTrue(Math.abs(out - 1.0) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.MM_SEC, Dimensions.Dim.INCH_MINUTE); assertTrue(Math.abs(out - 2.362204724409449) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.FOOT_MINUTE, Dimensions.Dim.MM_SEC); assertTrue(Math.abs(out - 5.08) < 0.0001); out = Dimensions.convert(1.0, Dimensions.Dim.INCH_SEC, Dimensions.Dim.FOOT_MINUTE); assertTrue(Math.abs(out - 5) < 0.0001); }