@Test public void testConvertMillimeter() { double mm = 1.0; double cm = 0.1; double dm = 0.01; double m = 0.001; double dam = 0.0001; double hm = 0.00001; double km = 0.000001; double in = 0.03937007874015748; double ft = 0.0032808398950131233; double yd = 0.0010936132983377078; double mi = 6.213711922373339E-7; double nm = 5.399568034557235E-7; double ly = 1.0570008340246155E-19; ConvertDistances converter0 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.MILLIMETER); Assert.assertEquals(mm, converter0.convert(mm), delta); ConvertDistances converter1 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.CENTIMETER); Assert.assertEquals(cm, converter1.convert(mm), delta); ConvertDistances converter2 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.DECIMETER); Assert.assertEquals(dm, converter2.convert(mm), delta); ConvertDistances converter3 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.METER); Assert.assertEquals(m, converter3.convert(mm), delta); ConvertDistances converter4 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.DEKAMETER); Assert.assertEquals(dam, converter4.convert(mm), delta); ConvertDistances converter5 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.HECTOMETER); Assert.assertEquals(hm, converter5.convert(mm), delta); ConvertDistances converter6 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.KILOMETER); Assert.assertEquals(km, converter6.convert(mm), delta); ConvertDistances converter7 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.INCH); Assert.assertEquals(in, converter7.convert(mm), delta); ConvertDistances converter8 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.FOOT); Assert.assertEquals(ft, converter8.convert(mm), delta); ConvertDistances converter9 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.YARD); Assert.assertEquals(yd, converter9.convert(mm), delta); ConvertDistances converter10 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.MILE); Assert.assertEquals(mi, converter10.convert(mm), delta); ConvertDistances converter11 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.NAUTICAL_MILE); Assert.assertEquals(nm, converter11.convert(mm), delta); ConvertDistances converter12 = new ConvertDistances(ConvertDistances.Distance.MILLIMETER, ConvertDistances.Distance.LIGHT_YEAR); Assert.assertEquals(ly, converter12.convert(mm), delta); }
public double convert(double value) { if (Double.isNaN(value)) { return value; } if (from.equals(to)) { return value; } BigDecimal result = new BigDecimal(String.valueOf(value)).multiply(multiplier); return result.doubleValue(); }
ConvertDistances { public double convert(double value) { if (Double.isNaN(value)) { return value; } if (from.equals(to)) { return value; } BigDecimal result = new BigDecimal(String.valueOf(value)).multiply(multiplier); return result.doubleValue(); } }
ConvertDistances { public double convert(double value) { if (Double.isNaN(value)) { return value; } if (from.equals(to)) { return value; } BigDecimal result = new BigDecimal(String.valueOf(value)).multiply(multiplier); return result.doubleValue(); } ConvertDistances(); @Nullable  ConvertDistances(Distance from, Distance to); }
ConvertDistances { public double convert(double value) { if (Double.isNaN(value)) { return value; } if (from.equals(to)) { return value; } BigDecimal result = new BigDecimal(String.valueOf(value)).multiply(multiplier); return result.doubleValue(); } ConvertDistances(); @Nullable  ConvertDistances(Distance from, Distance to); double convert(double value); }
ConvertDistances { public double convert(double value) { if (Double.isNaN(value)) { return value; } if (from.equals(to)) { return value; } BigDecimal result = new BigDecimal(String.valueOf(value)).multiply(multiplier); return result.doubleValue(); } ConvertDistances(); @Nullable  ConvertDistances(Distance from, Distance to); double convert(double value);  }