mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Added tests that ensures all version are in the Version#fromId(int) switch statement
This commit is contained in:
parent
994ad77032
commit
d49f099fdb
@ -24,8 +24,10 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import static org.elasticsearch.Version.V_0_20_0;
|
import static org.elasticsearch.Version.V_0_20_0;
|
||||||
import static org.elasticsearch.Version.V_0_90_0;
|
import static org.elasticsearch.Version.V_0_90_0;
|
||||||
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
import static org.hamcrest.Matchers.sameInstance;
|
||||||
|
|
||||||
public class VersionTests extends ElasticsearchTestCase {
|
public class VersionTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
@ -48,4 +50,16 @@ public class VersionTests extends ElasticsearchTestCase {
|
|||||||
assertThat(V_0_90_0.onOrAfter(V_0_20_0), is(true));
|
assertThat(V_0_90_0.onOrAfter(V_0_20_0), is(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testVersionConstantPresent() {
|
||||||
|
assertThat(Version.CURRENT, sameInstance(Version.fromId(Version.CURRENT.id)));
|
||||||
|
assertThat(Version.CURRENT.luceneVersion.ordinal(), equalTo(org.apache.lucene.util.Version.LUCENE_CURRENT.ordinal() - 1));
|
||||||
|
final int iters = atLeast(20);
|
||||||
|
for (int i = 0; i < iters; i++) {
|
||||||
|
Version version = randomVersion();
|
||||||
|
assertThat(version, sameInstance(Version.fromId(version.id)));
|
||||||
|
assertThat(version.luceneVersion, sameInstance(Version.fromId(version.id).luceneVersion));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user