@Test public void equality() { assertEquals(ServerVersion.VERSION_0_0_0, ServerVersion.from(0, 0, 0)); assertEquals(ServerVersion.VERSION_1_0_0, ServerVersion.from(1, 0, 0)); assertEquals(ServerVersion.VERSION_1_1_0, ServerVersion.from(1, 1, 0)); assertEquals(ServerVersion.VERSION_1_2_0, ServerVersion.from(1, 2, 0)); assertEquals(ServerVersion.VERSION_1_3_0, ServerVersion.from(1, 3, 0)); assertEquals(ServerVersion.VERSION_1_4_0, ServerVersion.from(1, 4, 0)); assertEquals(ServerVersion.VERSION_1_5_0, ServerVersion.from(1, 5, 0)); assertEquals(ServerVersion.VERSION_1_6_0, ServerVersion.from(1, 6, 0)); assertEquals(ServerVersion.VERSION_1_7_0, ServerVersion.from(1, 7, 0)); assertEquals(ServerVersion.VERSION_1_8_0, ServerVersion.from(1, 8, 0)); assertEquals(ServerVersion.VERSION_2_0_0, ServerVersion.from(2, 0, 0)); assertEquals(ServerVersion.VERSION_2_1_0, ServerVersion.from(2, 1, 0)); assertEquals(ServerVersion.VERSION_2_2_0, ServerVersion.from(2, 2, 0)); assertEquals(ServerVersion.VERSION_3_0_0, ServerVersion.from(3, 0, 0)); assertEquals(ServerVersion.VERSION_4_0_0, ServerVersion.from(4, 0, 0)); assertEquals(ServerVersion.VERSION_4_1_0, ServerVersion.from(4, 1, 0)); assertEquals(ServerVersion.VERSION_4_2_0, ServerVersion.from(4, 2, 0)); assertEquals(ServerVersion.VERSION_5_0_0, ServerVersion.from(5, 0, 0)); assertEquals(ServerVersion.VERSION_6_0_0, ServerVersion.from(6, 0, 0)); assertEquals(ServerVersion.VERSION_7_0_0, ServerVersion.from(7, 0, 0)); assertEquals(ServerVersion.VERSION_8_0_0, ServerVersion.from(8, 0, 0)); assertEquals(ServerVersion.from(42, 42, 42), ServerVersion.from(42, 42, 42)); }
public static ServerVersion from(int major, int minor, int micro) { for (ServerVersion knownVersion : KNOWN_VERSIONS) { if (knownVersion.major == major && knownVersion.minor == minor && knownVersion.micro == micro) { return knownVersion; } } return new ServerVersion(major, minor, micro); }
ServerVersion { public static ServerVersion from(int major, int minor, int micro) { for (ServerVersion knownVersion : KNOWN_VERSIONS) { if (knownVersion.major == major && knownVersion.minor == minor && knownVersion.micro == micro) { return knownVersion; } } return new ServerVersion(major, minor, micro); } }
ServerVersion { public static ServerVersion from(int major, int minor, int micro) { for (ServerVersion knownVersion : KNOWN_VERSIONS) { if (knownVersion.major == major && knownVersion.minor == minor && knownVersion.micro == micro) { return knownVersion; } } return new ServerVersion(major, minor, micro); } private  ServerVersion(int major, int minor, int micro); }
ServerVersion { public static ServerVersion from(int major, int minor, int micro) { for (ServerVersion knownVersion : KNOWN_VERSIONS) { if (knownVersion.major == major && knownVersion.minor == minor && knownVersion.micro == micro) { return knownVersion; } } return new ServerVersion(major, minor, micro); } private  ServerVersion(int major, int minor, int micro); static ServerVersion from(int major, int minor, int micro); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); ServerVersionRange upTo(ServerVersion other); ServerVersionRange upToAndIncluding(ServerVersion other); boolean equalTo(ServerVersion that); boolean lessThan(ServerVersion that); boolean lessThanOrEqualTo(ServerVersion that); boolean greaterThan(ServerVersion that); boolean greaterThanOrEqualTo(ServerVersion that); @Deprecated boolean inRange(ServerVersion min, ServerVersion max); boolean inRange(ServerVersionRange range); void assertAtLeast(ServerVersion minimum); void assertAtLeast(ServerVersion minimum, String message); }
ServerVersion { public static ServerVersion from(int major, int minor, int micro) { for (ServerVersion knownVersion : KNOWN_VERSIONS) { if (knownVersion.major == major && knownVersion.minor == minor && knownVersion.micro == micro) { return knownVersion; } } return new ServerVersion(major, minor, micro); } private  ServerVersion(int major, int minor, int micro); static ServerVersion from(int major, int minor, int micro); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); ServerVersionRange upTo(ServerVersion other); ServerVersionRange upToAndIncluding(ServerVersion other); boolean equalTo(ServerVersion that); boolean lessThan(ServerVersion that); boolean lessThanOrEqualTo(ServerVersion that); boolean greaterThan(ServerVersion that); boolean greaterThanOrEqualTo(ServerVersion that); @Deprecated boolean inRange(ServerVersion min, ServerVersion max); boolean inRange(ServerVersionRange range); void assertAtLeast(ServerVersion minimum); void assertAtLeast(ServerVersion minimum, String message); static final ServerVersion VERSION_0_0_0; static final ServerVersion VERSION_1_0_0; static final ServerVersion VERSION_1_1_0; static final ServerVersion VERSION_1_2_0; static final ServerVersion VERSION_1_3_0; static final ServerVersion VERSION_1_4_0; static final ServerVersion VERSION_1_5_0; static final ServerVersion VERSION_1_6_0; static final ServerVersion VERSION_1_7_0; static final ServerVersion VERSION_1_8_0; static final ServerVersion VERSION_2_0_0; static final ServerVersion VERSION_2_1_0; static final ServerVersion VERSION_2_2_0; static final ServerVersion VERSION_3_0_0; static final ServerVersion VERSION_4_0_0; static final ServerVersion VERSION_4_1_0; static final ServerVersion VERSION_4_2_0; static final ServerVersion VERSION_5_0_0; static final ServerVersion VERSION_6_0_0; static final ServerVersion VERSION_7_0_0; static final ServerVersion VERSION_8_0_0; }