ValuesInSIUnits { public static double convertJerk(double jerk, LengthUnit sourceLengthUnit, TimeUnit sourceTimeUnit) { return jerk * LengthUnit.METERS.getUnitsIn(sourceLengthUnit) / Math.pow(getTimeUnitAsSeconds(sourceTimeUnit), 3); } private  ValuesInSIUnits(); static double convertDuration(double duration, TimeUnit sourceUnit); static double convertSpeed(double speed, LengthUnit sourceLengthUnit, TimeUnit sourceTimeUnit); static double convertAcceleration(double acceleration, LengthUnit sourceLengthUnit, TimeUnit sourceTimeUnit); static double convertJerk(double jerk, LengthUnit sourceLengthUnit, TimeUnit sourceTimeUnit);  }
@Test void convertJerk_whenValueGetsLarger_thenPrecisionIsMaintained() { double mmPerMsJerk = 1.31211; double siSpeed = mmPerMsJerk * 1000 * 1000 * 1000 / 1000; assertThat(ValuesInSIUnits.convertJerk(mmPerMsJerk, LengthUnit.MILLIMETERS, TimeUnit.MILLISECONDS)).isCloseTo(siSpeed, withinPercentage(TOLERANCE)); }
@Test void convertJerk_whenValueGetsSmaller_thenPrecisionIsMaintained() { double mmPerMinuteJerk = 1.31211; double siSpeed = mmPerMinuteJerk / (1000L * 60L * 60L * 60L); assertThat(ValuesInSIUnits.convertJerk(mmPerMinuteJerk, LengthUnit.MILLIMETERS, TimeUnit.MINUTES)).isCloseTo(siSpeed, withinPercentage(TOLERANCE)); }