### Question:
DefaultUpgradeService implements UpgradeService { protected static double decodeVersion(String version) { if (version == null || isBlank(version)) { return 0; } StringBuilder buffer = new StringBuilder(version.length()); boolean dotProcessed = false; for (int i = 0; i < version.length(); i++) { char nextChar = version.charAt(i); if (nextChar == '.' && !dotProcessed) { dotProcessed = true; buffer.append('.'); } else if (Character.isDigit(nextChar)) { buffer.append(nextChar); } } return Double.parseDouble(buffer.toString()); } DefaultUpgradeService(@Inject List<UpgradeHandler> handlerList); @Override UpgradeMetaData getUpgradeType(Resource resource); @Override Resource upgradeProject(Resource resource); static final String UNKNOWN_VERSION; static final String MIN_SUPPORTED_VERSION; }### Answer:
@Test public void decodeVersion() throws Exception { assertEquals(1.2340, DefaultUpgradeService.decodeVersion("1.2.3.4"), 0.000001); assertEquals(1.0004, DefaultUpgradeService.decodeVersion("1.0.0.0.4"), 0.000001); assertEquals(10, DefaultUpgradeService.decodeVersion("10"), 0.000001); }