Remove ImmutableMap$Builder from tests!
This commit is contained in:
parent
380dbbfb23
commit
34e28ea6ff
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.client;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.GenericAction;
|
||||
|
@ -138,10 +137,9 @@ public abstract class AbstractClientHeadersTestCase extends ESTestCase {
|
|||
@Test
|
||||
public void testOverideHeader() throws Exception {
|
||||
String key1Val = randomAsciiOfLength(5);
|
||||
Map<String, Object> expected = ImmutableMap.<String, Object>builder()
|
||||
.put("key1", key1Val)
|
||||
.put("key2", "val 2")
|
||||
.build();
|
||||
Map<String, Object> expected = new HashMap<>();
|
||||
expected.put("key1", key1Val);
|
||||
expected.put("key2", "val 2");
|
||||
|
||||
client.prepareGet("idx", "type", "id")
|
||||
.putHeader("key1", key1Val)
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.elasticsearch.cluster.serialization;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.elasticsearch.cluster.AbstractDiffable;
|
||||
import org.elasticsearch.cluster.Diff;
|
||||
import org.elasticsearch.cluster.DiffableUtils;
|
||||
|
@ -44,11 +42,11 @@ public class DiffableTests extends ESTestCase {
|
|||
|
||||
@Test
|
||||
public void testJdkMapDiff() throws IOException {
|
||||
ImmutableMap.Builder<String, TestDiffable> builder = ImmutableMap.builder();
|
||||
builder.put("foo", new TestDiffable("1"));
|
||||
builder.put("bar", new TestDiffable("2"));
|
||||
builder.put("baz", new TestDiffable("3"));
|
||||
ImmutableMap<String, TestDiffable> before = builder.build();
|
||||
Map<String, TestDiffable> before = new HashMap<>();
|
||||
before.put("foo", new TestDiffable("1"));
|
||||
before.put("bar", new TestDiffable("2"));
|
||||
before.put("baz", new TestDiffable("3"));
|
||||
before = unmodifiableMap(before);
|
||||
Map<String, TestDiffable> map = new HashMap<>();
|
||||
map.putAll(before);
|
||||
map.remove("bar");
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.common.cli;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -29,14 +28,20 @@ import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
import static org.elasticsearch.common.cli.CliTool.ExitStatus.OK;
|
||||
import static org.elasticsearch.common.cli.CliTool.ExitStatus.USAGE;
|
||||
import static org.elasticsearch.common.cli.CliToolConfig.Builder.cmd;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.arrayContaining;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -387,11 +392,11 @@ public class CliToolTests extends CliToolTestCase {
|
|||
super(CliToolConfig.config(name, MultiCmdTool.class)
|
||||
.cmds(cmds(commands))
|
||||
.build(), terminal);
|
||||
ImmutableMap.Builder<String, Command> commandByName = ImmutableMap.builder();
|
||||
Map<String, Command> commandByName = new HashMap<>();
|
||||
for (int i = 0; i < commands.length; i++) {
|
||||
commandByName.put(commands[i].name, commands[i]);
|
||||
}
|
||||
this.commands = commandByName.build();
|
||||
this.commands = unmodifiableMap(commandByName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,16 +18,25 @@
|
|||
*/
|
||||
package org.elasticsearch.common.lucene.uid;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.core.KeywordAnalyzer;
|
||||
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
|
||||
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.Field.Store;
|
||||
import org.apache.lucene.index.*;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.LeafReader;
|
||||
import org.apache.lucene.index.NumericDocValues;
|
||||
import org.apache.lucene.index.SlowCompositeReaderWrapper;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.common.Numbers;
|
||||
|
@ -41,13 +50,17 @@ import org.junit.Test;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
public class VersionsTests extends ESTestCase {
|
||||
|
||||
|
||||
public static DirectoryReader reopen(DirectoryReader reader) throws IOException {
|
||||
return reopen(reader, true);
|
||||
}
|
||||
|
@ -99,7 +112,7 @@ public class VersionsTests extends ESTestCase {
|
|||
doc.add(uid);
|
||||
doc.add(version);
|
||||
writer.updateDocument(new Term(UidFieldMapper.NAME, "1"), doc);
|
||||
|
||||
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(3l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(3l));
|
||||
|
@ -261,8 +274,13 @@ public class VersionsTests extends ESTestCase {
|
|||
iw.addDocument(document);
|
||||
iw.commit();
|
||||
|
||||
final Map<String, Long> expectedVersions = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 0L).put("2", 0L).put("3", 0L).put("4", 4L).put("5", 5L).put("6", 6L).build();
|
||||
Map<String, Long> expectedVersions = new HashMap<>();
|
||||
expectedVersions.put("1", 0L);
|
||||
expectedVersions.put("2", 0L);
|
||||
expectedVersions.put("3", 0L);
|
||||
expectedVersions.put("4", 4L);
|
||||
expectedVersions.put("5", 5L);
|
||||
expectedVersions.put("6", 6L);
|
||||
|
||||
// Force merge and check versions
|
||||
iw.forceMerge(1, true);
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.elasticsearch.script;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
|
@ -38,6 +36,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static java.util.Collections.singleton;
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
import static java.util.Collections.unmodifiableSet;
|
||||
import static org.elasticsearch.common.util.set.Sets.newHashSet;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
@ -244,14 +243,14 @@ public class ScriptModesTests extends ESTestCase {
|
|||
return ScriptModes.ENGINE_SETTINGS_PREFIX + "." + lang + "." + scriptType + "." + scriptContext.getKey();
|
||||
}
|
||||
|
||||
static ImmutableMap<String, ScriptEngineService> buildScriptEnginesByLangMap(Set<ScriptEngineService> scriptEngines) {
|
||||
ImmutableMap.Builder<String, ScriptEngineService> builder = ImmutableMap.builder();
|
||||
static Map<String, ScriptEngineService> buildScriptEnginesByLangMap(Set<ScriptEngineService> scriptEngines) {
|
||||
Map<String, ScriptEngineService> builder = new HashMap<>();
|
||||
for (ScriptEngineService scriptEngine : scriptEngines) {
|
||||
for (String type : scriptEngine.types()) {
|
||||
builder.put(type, scriptEngine);
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
return unmodifiableMap(builder);
|
||||
}
|
||||
|
||||
private static class CustomScriptEngineService implements ScriptEngineService {
|
||||
|
|
|
@ -18,14 +18,13 @@
|
|||
*/
|
||||
package org.elasticsearch.search.aggregations.bucket;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
|
@ -49,16 +48,15 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<String, Long> expected = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 8l)
|
||||
.put("3", 8l)
|
||||
.put("2", 5l)
|
||||
.build();
|
||||
Map<String, Long> expected = new HashMap<>();
|
||||
expected.put("1", 8l);
|
||||
expected.put("3", 8l);
|
||||
expected.put("2", 5l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsString())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shardSizeEqualsSize_string() throws Exception {
|
||||
createIdx("type=string,index=not_analyzed");
|
||||
|
@ -74,11 +72,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<String, Long> expected = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 8l)
|
||||
.put("3", 8l)
|
||||
.put("2", 4l)
|
||||
.build();
|
||||
Map<String, Long> expected = new HashMap<>();
|
||||
expected.put("1", 8l);
|
||||
expected.put("3", 8l);
|
||||
expected.put("2", 4l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsString())));
|
||||
}
|
||||
|
@ -100,11 +97,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
|
||||
Map<String, Long> expected = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 8l)
|
||||
.put("3", 8l)
|
||||
.put("2", 5l) // <-- count is now fixed
|
||||
.build();
|
||||
Map<String, Long> expected = new HashMap<>();
|
||||
expected.put("1", 8l);
|
||||
expected.put("3", 8l);
|
||||
expected.put("2", 5l); // <-- count is now fixed
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsString())));
|
||||
}
|
||||
|
@ -126,16 +122,15 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
|
||||
Map<String, Long> expected = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 5l)
|
||||
.put("2", 4l)
|
||||
.put("3", 3l) // <-- count is now fixed
|
||||
.build();
|
||||
Map<String, Long> expected = new HashMap<>();
|
||||
expected.put("1", 5l);
|
||||
expected.put("2", 4l);
|
||||
expected.put("3", 3l); // <-- count is now fixed
|
||||
for (Terms.Bucket bucket: buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKey())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void noShardSizeTermOrder_string() throws Exception {
|
||||
createIdx("type=string,index=not_analyzed");
|
||||
|
@ -151,11 +146,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<String, Long> expected = ImmutableMap.<String, Long>builder()
|
||||
.put("1", 8l)
|
||||
.put("2", 5l)
|
||||
.put("3", 8l)
|
||||
.build();
|
||||
Map<String, Long> expected = new HashMap<>();
|
||||
expected.put("1", 8l);
|
||||
expected.put("2", 5l);
|
||||
expected.put("3", 8l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsString())));
|
||||
}
|
||||
|
@ -177,11 +171,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 5l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 5l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -203,11 +196,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 4l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 4l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -229,11 +221,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 5l) // <-- count is now fixed
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 5l); // <-- count is now fixed
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -255,11 +246,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 5l)
|
||||
.put(2, 4l)
|
||||
.put(3, 3l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 5l);
|
||||
expected.put(2, 4l);
|
||||
expected.put(3, 3l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -281,11 +271,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(2, 5l)
|
||||
.put(3, 8l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(2, 5l);
|
||||
expected.put(3, 8l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -307,11 +296,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 5l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 5l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -333,11 +321,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 4l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 4l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -359,11 +346,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(3, 8l)
|
||||
.put(2, 5l) // <-- count is now fixed
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(3, 8l);
|
||||
expected.put(2, 5l); // <-- count is now fixed
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -385,11 +371,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 5l)
|
||||
.put(2, 4l)
|
||||
.put(3, 3l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 5l);
|
||||
expected.put(2, 4l);
|
||||
expected.put(3, 3l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
@ -411,11 +396,10 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
|
|||
Terms terms = response.getAggregations().get("keys");
|
||||
Collection<Terms.Bucket> buckets = terms.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Map<Integer, Long> expected = ImmutableMap.<Integer, Long>builder()
|
||||
.put(1, 8l)
|
||||
.put(2, 5l)
|
||||
.put(3, 8l)
|
||||
.build();
|
||||
Map<Integer, Long> expected = new HashMap<>();
|
||||
expected.put(1, 8l);
|
||||
expected.put(2, 5l);
|
||||
expected.put(3, 8l);
|
||||
for (Terms.Bucket bucket : buckets) {
|
||||
assertThat(bucket.getDocCount(), equalTo(expected.get(bucket.getKeyAsNumber().intValue())));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue