From b19537cae6b0fbf1b94755ec7c4e15a1c0e60506 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 18 May 2017 10:45:58 +0200 Subject: [PATCH] Add utility method to get the latest version of the previous minor --- .../main/java/org/elasticsearch/test/VersionUtils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/framework/src/main/java/org/elasticsearch/test/VersionUtils.java b/test/framework/src/main/java/org/elasticsearch/test/VersionUtils.java index a8700834105..5d8af02a066 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/VersionUtils.java +++ b/test/framework/src/main/java/org/elasticsearch/test/VersionUtils.java @@ -107,6 +107,16 @@ public class VersionUtils { return version; } + /** Returns the {@link Version} before the {@link Version#CURRENT} where the minor version is less than the currents minor version. */ + public static Version getPreviousMinorVersion() { + Version version = Version.CURRENT; + do { + version = getPreviousVersion(version); + assert version.before(Version.CURRENT); + } while (version.minor == Version.CURRENT.minor); + return version; + } + /** Returns the oldest {@link Version} */ public static Version getFirstVersion() { return RELEASED_VERSIONS.get(0);