@Test public void shouldReturnCorrectNumber_whenDotIsDecimalSeparator() { Locale.setDefault(new Locale("en")); assertThat(ReadingTools.parseReading("1.23").doubleValue()).isEqualTo(1.23); }
@Nullable public static Number parseReading(String reading) { if (reading == null) return null; NumberFormat numberFormat = NumberFormat.getInstance(); try { return numberFormat.parse(reading); } catch (ParseException e) { return null; } }
ReadingTools { @Nullable public static Number parseReading(String reading) { if (reading == null) return null; NumberFormat numberFormat = NumberFormat.getInstance(); try { return numberFormat.parse(reading); } catch (ParseException e) { return null; } } }
ReadingTools { @Nullable public static Number parseReading(String reading) { if (reading == null) return null; NumberFormat numberFormat = NumberFormat.getInstance(); try { return numberFormat.parse(reading); } catch (ParseException e) { return null; } } ReadingTools(); }
ReadingTools { @Nullable public static Number parseReading(String reading) { if (reading == null) return null; NumberFormat numberFormat = NumberFormat.getInstance(); try { return numberFormat.parse(reading); } catch (ParseException e) { return null; } } ReadingTools(); int hourToSpinnerType(int hour); @Nullable static Number parseReading(String reading); static double safeParseDouble(String doubleValue); }
ReadingTools { @Nullable public static Number parseReading(String reading) { if (reading == null) return null; NumberFormat numberFormat = NumberFormat.getInstance(); try { return numberFormat.parse(reading); } catch (ParseException e) { return null; } } ReadingTools(); int hourToSpinnerType(int hour); @Nullable static Number parseReading(String reading); static double safeParseDouble(String doubleValue);  }