Source:
<code>public static void assumeGoVersionAtLeast(String minimumVersion) { List<Integer> minimumVersionNumbers = getVersionNumbers(minimumVersion); Assume.assumeTrue( "Expect minimum version string in the form of x.y.z, got" + minimumVersion, minimumVersionNumbers.size() == 3); Throwable exception = null; String actualVersion = "0.0.0"; ProcessExecutor processExecutor = new DefaultProcessExecutor(new TestConsole()); try { ProcessExecutor.Result goToolResult = processExecutor.launchAndExecute( ProcessExecutorParams.builder().addCommand("go", "version").build(), EnumSet.of(ProcessExecutor.Option.EXPECTING_STD_OUT), Optional.empty(), Optional.empty(), Optional.empty()); if (goToolResult.getExitCode() == 0) { <START> actualVersion = goToolResult.getStdout().get().substring(13, 18); <END> } else { exception = new HumanReadableException(goToolResult.getStderr().get()); } } catch (Exception e) { exception = e; } assumeNoException(exception); List<Integer> actualVersionNumbers = getVersionNumbers(actualVersion); Assume.assumeTrue( "Expect actual version string in the form of x.y.z, got" + actualVersion, actualVersionNumbers.size() == 3); boolean versionSatisfied = true; for (int i = 0; i < 3; i++) { if (actualVersionNumbers.get(i) < minimumVersionNumbers.get(i)) { versionSatisfied = false; break; } else if (actualVersionNumbers.get(i) > minimumVersionNumbers.get(i)) { versionSatisfied = true; break; } } Assume.assumeTrue("Actual Go version is lower than the required version", versionSatisfied); }</code><technical_language>work for versions '1.10.123'. regex instead? ((\d)+)\.((\d)+)\.((\d)+)</technical_language>

Target:
public static void assumeGoVersionAtLeast(String minimumVersion) { List<Integer> minimumVersionNumbers = Arrays.stream(minimumVersion.split("\\.")) .map(Integer::valueOf) .collect(Collectors.toList()); Assume.assumeTrue( "Expect minimum version string in the form of x.y.z, got: " + minimumVersion, minimumVersionNumbers.size() == 3); Throwable exception = null; List<Integer> actualVersionNumbers = null; ProcessExecutor processExecutor = new DefaultProcessExecutor(new TestConsole()); try { ProcessExecutor.Result goToolResult = processExecutor.launchAndExecute( ProcessExecutorParams.builder().addCommand("go", "version").build(), EnumSet.of(ProcessExecutor.Option.EXPECTING_STD_OUT), Optional.empty(), Optional.empty(), Optional.empty()); if (goToolResult.getExitCode() == 0) { String versionOut = goToolResult.getStdout().get().trim(); Matcher matcher = VERSION_PATTERN.matcher(versionOut); if (matcher.matches()) { actualVersionNumbers = IntStream.range(1, 4) .mapToObj(matcher::group) .map(Integer::valueOf) .collect(Collectors.toList()); } else { exception = new HumanReadableException("Unknown version: " + versionOut); } } else { exception = new HumanReadableException(goToolResult.getStderr().get()); } } catch (Exception e) { exception = e; } assumeNoException(exception); boolean versionSatisfied = true; for (int i = 0; i < 3; i++) { if (actualVersionNumbers.get(i) < minimumVersionNumbers.get(i)) { versionSatisfied = false; break; } else if (actualVersionNumbers.get(i) > minimumVersionNumbers.get(i)) { versionSatisfied = true; break; } } Assume.assumeTrue("Actual Go version is lower than the required version", versionSatisfied); }