@Test @Parameters({ "5.61, 5.61", "6.01, 6.01" }) public void shouldParseValidDouble(String versionCode, String expected) { double expectedCode = Double.valueOf(expected); double resultCode = VersionParser.toDouble(versionCode); assertThat(resultCode, Is.is(expectedCode)); }
public static double toDouble(String version) { if (version != null) { try { return Double.parseDouble(version); } catch (NumberFormatException ex) { if (version.contains(".")) { return parseAsVersionName(version); } else { return parseAsNumber(version); } } } return INVALID_VERSION; }
VersionParser { public static double toDouble(String version) { if (version != null) { try { return Double.parseDouble(version); } catch (NumberFormatException ex) { if (version.contains(".")) { return parseAsVersionName(version); } else { return parseAsNumber(version); } } } return INVALID_VERSION; } }
VersionParser { public static double toDouble(String version) { if (version != null) { try { return Double.parseDouble(version); } catch (NumberFormatException ex) { if (version.contains(".")) { return parseAsVersionName(version); } else { return parseAsNumber(version); } } } return INVALID_VERSION; } private  VersionParser(); }
VersionParser { public static double toDouble(String version) { if (version != null) { try { return Double.parseDouble(version); } catch (NumberFormatException ex) { if (version.contains(".")) { return parseAsVersionName(version); } else { return parseAsNumber(version); } } } return INVALID_VERSION; } private  VersionParser(); static double toDouble(String version); }
VersionParser { public static double toDouble(String version) { if (version != null) { try { return Double.parseDouble(version); } catch (NumberFormatException ex) { if (version.contains(".")) { return parseAsVersionName(version); } else { return parseAsNumber(version); } } } return INVALID_VERSION; } private  VersionParser(); static double toDouble(String version);  }