@Test public void versionTest() { KubernetesVersion kv1p9 = new KubernetesVersion(1, 5); assertThat(kv1p9.compareTo(KubernetesVersion.V1_8), lessThan(0)); assertThat(kv1p9.compareTo(KubernetesVersion.V1_9), lessThan(0)); assertThat(kv1p9.compareTo(KubernetesVersion.V1_10), lessThan(0)); assertThat(kv1p9.compareTo(KubernetesVersion.V1_11), lessThan(0)); assertThat(KubernetesVersion.V1_8.compareTo(KubernetesVersion.V1_8), is(0)); assertThat(KubernetesVersion.V1_8.compareTo(KubernetesVersion.V1_9), lessThan(0)); assertThat(KubernetesVersion.V1_8.compareTo(KubernetesVersion.V1_10), lessThan(0)); assertThat(KubernetesVersion.V1_8.compareTo(KubernetesVersion.V1_11), lessThan(0)); assertThat(KubernetesVersion.V1_12.compareTo(KubernetesVersion.V1_8), greaterThan(0)); assertThat(KubernetesVersion.V1_12.compareTo(KubernetesVersion.V1_9), greaterThan(0)); assertThat(KubernetesVersion.V1_12.compareTo(KubernetesVersion.V1_10), greaterThan(0)); assertThat(KubernetesVersion.V1_12.compareTo(KubernetesVersion.V1_11), greaterThan(0)); assertThat(KubernetesVersion.V1_12.compareTo(KubernetesVersion.V1_12), is(0)); KubernetesVersion kv2p9 = new KubernetesVersion(2, 9); assertThat(kv2p9.compareTo(KubernetesVersion.V1_8), greaterThan(0)); assertThat(kv2p9.compareTo(KubernetesVersion.V1_9), greaterThan(0)); assertThat(kv2p9.compareTo(KubernetesVersion.V1_10), greaterThan(0)); assertThat(kv2p9.compareTo(KubernetesVersion.V1_11), greaterThan(0)); }
@Override public int compareTo(KubernetesVersion o) { int cmp = Integer.compare(major, o.major); if (cmp == 0) { cmp = Integer.compare(minor, o.minor); } return cmp; }
KubernetesVersion implements Comparable<KubernetesVersion> { @Override public int compareTo(KubernetesVersion o) { int cmp = Integer.compare(major, o.major); if (cmp == 0) { cmp = Integer.compare(minor, o.minor); } return cmp; } }
KubernetesVersion implements Comparable<KubernetesVersion> { @Override public int compareTo(KubernetesVersion o) { int cmp = Integer.compare(major, o.major); if (cmp == 0) { cmp = Integer.compare(minor, o.minor); } return cmp; } KubernetesVersion(int major, int minor); }
KubernetesVersion implements Comparable<KubernetesVersion> { @Override public int compareTo(KubernetesVersion o) { int cmp = Integer.compare(major, o.major); if (cmp == 0) { cmp = Integer.compare(minor, o.minor); } return cmp; } KubernetesVersion(int major, int minor); @Override int hashCode(); @Override boolean equals(Object o); @Override int compareTo(KubernetesVersion o); @Override String toString(); }
KubernetesVersion implements Comparable<KubernetesVersion> { @Override public int compareTo(KubernetesVersion o) { int cmp = Integer.compare(major, o.major); if (cmp == 0) { cmp = Integer.compare(minor, o.minor); } return cmp; } KubernetesVersion(int major, int minor); @Override int hashCode(); @Override boolean equals(Object o); @Override int compareTo(KubernetesVersion o); @Override String toString(); static final KubernetesVersion V1_8; static final KubernetesVersion V1_9; static final KubernetesVersion V1_10; static final KubernetesVersion V1_11; static final KubernetesVersion V1_12; static final KubernetesVersion V1_13; static final KubernetesVersion V1_14; static final KubernetesVersion MINIMAL_SUPPORTED_VERSION; static final int MINIMAL_SUPPORTED_MAJOR; static final int MINIMAL_SUPPORTED_MINOR; }