|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License |
| 4 | + * 2.0 and the Server Side Public License, v 1; you may not use this file except |
| 5 | + * in compliance with, at your election, the Elastic License 2.0 or the Server |
| 6 | + * Side Public License, v 1. |
| 7 | + */ |
| 8 | + |
| 9 | +package org.elasticsearch.action.admin.cluster.stats; |
| 10 | + |
| 11 | +import org.elasticsearch.common.Strings; |
| 12 | +import org.elasticsearch.common.io.stream.Writeable; |
| 13 | +import org.elasticsearch.test.AbstractWireSerializingTestCase; |
| 14 | + |
| 15 | +public class IndexFeatureStatsTests extends AbstractWireSerializingTestCase<IndexFeatureStats> { |
| 16 | + @Override |
| 17 | + protected Writeable.Reader<IndexFeatureStats> instanceReader() { |
| 18 | + return IndexFeatureStats::new; |
| 19 | + } |
| 20 | + |
| 21 | + @Override |
| 22 | + protected IndexFeatureStats createTestInstance() { |
| 23 | + IndexFeatureStats indexFeatureStats = new IndexFeatureStats(randomAlphaOfLengthBetween(3, 10)); |
| 24 | + indexFeatureStats.indexCount = randomIntBetween(0, Integer.MAX_VALUE); |
| 25 | + indexFeatureStats.count = randomIntBetween(0, Integer.MAX_VALUE); |
| 26 | + return indexFeatureStats; |
| 27 | + } |
| 28 | + |
| 29 | + public void testToXContent() { |
| 30 | + IndexFeatureStats testInstance = createTestInstance(); |
| 31 | + assertEquals("{\"name\":\"" + testInstance.name + |
| 32 | + "\",\"count\":" + testInstance.count + |
| 33 | + ",\"index_count\":" + testInstance.indexCount + "}", Strings.toString(testInstance)); |
| 34 | + } |
| 35 | +} |
0 commit comments