public boolean sameOrHigher(Version other) {
        if (isNullOrEmpty(version.preReleaseVersion().orElse(""))) {
            return version.isHigherThanOrEquivalentTo(other.getVersion());
        } else {
            // If this is a pre-release version, use the major.minor.patch version for comparison with the other.
            // This allows plugins to require a server version of 2.1.0 and it still gets loaded on a 2.1.0-beta.2 server.
            // See: https://github.com/Graylog2/graylog2-server/issues/2462
            String version1 = version.toStableVersion().toString();
            com.github.zafarkhaja.semver.Version version2 = com.github.zafarkhaja.semver.Version.parse(version1);
            return version2.isHigherThanOrEquivalentTo(other.getVersion());
        }
    }
@Test
    public void testSameOrHigher() throws Exception {
        Version v = Version.from(0, 20, 2);

        assertTrue(v.sameOrHigher(Version.from(0, 19, 0)));
        assertTrue(v.sameOrHigher(Version.from(0, 18, 2)));
        assertTrue(v.sameOrHigher(Version.from(0, 19, 9001)));

        assertTrue(v.sameOrHigher(Version.from(0, 20, 0)));
        assertFalse(v.sameOrHigher(Version.from(1, 0, 0)));
        assertFalse(v.sameOrHigher(Version.from(1, 0, 9001)));
        assertFalse(v.sameOrHigher(Version.from(1, 20, 0)));
        assertFalse(v.sameOrHigher(Version.from(1, 1, 0)));
        assertFalse(v.sameOrHigher(Version.from(3, 2, 1)));

        assertTrue(v.sameOrHigher(Version.from(0, 19, 0, "rc.1")));
        assertFalse(v.sameOrHigher(Version.from(1, 19, 0, "rc.1")));
        assertFalse(v.sameOrHigher(Version.from(0, 21, 0, "rc.1")));
        assertTrue(v.sameOrHigher(Version.from(0, 20, 1, "rc.1")));
        assertTrue(v.sameOrHigher(Version.from(0, 20, 0, "rc.1")));
        assertTrue(v.sameOrHigher(Version.from(0, 20, 2, "rc.1")));
        assertFalse(v.sameOrHigher(Version.from(0, 20, 3, "rc.1")));

        v = Version.from(1, 5, 0);

        assertTrue(v.sameOrHigher(Version.from(0, 19, 0)));
        assertTrue(v.sameOrHigher(Version.from(1, 0, 0)));
        assertTrue(v.sameOrHigher(Version.from(0, 19, 9001)));
        assertTrue(v.sameOrHigher(Version.from(1, 5, 0)));
        assertTrue(v.sameOrHigher(Version.from(1, 4, 9)));

        assertFalse(v.sameOrHigher(Version.from(1, 6, 0)));
        assertFalse(v.sameOrHigher(Version.from(3, 0, 0)));
        assertFalse(v.sameOrHigher(Version.from(1, 5, 9001)));
        assertFalse(v.sameOrHigher(Version.from(1, 20, 0)));
        assertFalse(v.sameOrHigher(Version.from(1, 20, 5)));
        assertFalse(v.sameOrHigher(Version.from(3, 2, 1)));

        assertTrue(v.sameOrHigher(Version.from(0, 19, 0, "rc.1")));
        assertFalse(v.sameOrHigher(Version.from(2, 19, 0, "rc.1")));
        assertTrue(v.sameOrHigher(Version.from(0, 0, 0)));
        assertFalse(v.sameOrHigher(Version.from(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE)));

        // See https://github.com/Graylog2/graylog2-server/issues/2462
        v = Version.from(2, 1, 0, "beta.2");

        assertTrue(v.sameOrHigher(Version.from(2, 1, 0, "alpha.1")));
        assertTrue(v.sameOrHigher(Version.from(2, 1, 0, "beta.1")));
        assertTrue(v.sameOrHigher(Version.from(2, 1, 0, "beta.2")));
        assertTrue(v.sameOrHigher(Version.from(2, 1, 0))); // This needs to work!
        assertFalse(v.sameOrHigher(Version.from(2, 2, 0, "alpha.1")));
        assertFalse(v.sameOrHigher(Version.from(2, 2, 0)));
    }