Only assert that analyzers are the same if lucene version is the same

This commit is contained in:
Simon Willnauer 2016-03-07 11:55:56 +01:00
parent f071f327db
commit a29f734b75
1 changed files with 8 additions and 4 deletions

View File

@ -63,10 +63,14 @@ public class PreBuiltAnalyzerTests extends ESSingleNodeTestCase {
}
public void testThatInstancesAreCachedAndReused() {
assertThat(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT),
is(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT)));
assertThat(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_0_0),
is(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_2_0)));
assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT));
// same lucene version should be cached
assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_0_0),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_0_1));
assertNotSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_0_0),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_2_2_0));
}
public void testThatAnalyzersAreUsedInMapping() throws IOException {