Skip to content

Commit 4723419

Browse files
committed
Use Strings#EMPTY_ARRAY (#79452)
Trivial follow-up to #79351 that introduced some spots that create fresh empty string arrays.
1 parent 9184b4c commit 4723419

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.elasticsearch.cluster.health.ClusterIndexHealthTests;
1616
import org.elasticsearch.cluster.health.ClusterStateHealth;
1717
import org.elasticsearch.cluster.metadata.Metadata;
18+
import org.elasticsearch.common.Strings;
1819
import org.elasticsearch.common.io.stream.BytesStreamOutput;
1920
import org.elasticsearch.common.io.stream.StreamInput;
2021
import org.elasticsearch.common.io.stream.Writeable;
@@ -43,7 +44,7 @@ public class ClusterHealthResponsesTests extends AbstractSerializingTestCase<Clu
4344
private final ClusterHealthRequest.Level level = randomFrom(ClusterHealthRequest.Level.values());
4445

4546
public void testIsTimeout() {
46-
ClusterHealthResponse res = new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false);
47+
ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false);
4748
for (int i = 0; i < 5; i++) {
4849
res.setTimedOut(randomBoolean());
4950
if (res.isTimedOut()) {
@@ -56,7 +57,7 @@ public void testIsTimeout() {
5657
}
5758

5859
public void testTimeoutReturns200IfOptedIn() {
59-
ClusterHealthResponse res = new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, true);
60+
ClusterHealthResponse res = new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, true);
6061
for (int i = 0; i < 5; i++) {
6162
res.setTimedOut(randomBoolean());
6263
assertEquals(RestStatus.OK, res.status());

x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenShardInitializationPen
190190
doAnswer(invocationOnMock -> {
191191
@SuppressWarnings("unchecked")
192192
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
193-
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
193+
listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
194194
return null;
195195
}).when(clusterClient).health(any(), any());
196196

@@ -274,7 +274,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenConcurrentCreationShar
274274
doAnswer(invocationOnMock -> {
275275
@SuppressWarnings("unchecked")
276276
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
277-
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
277+
listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
278278
return null;
279279
}).when(clusterClient).health(any(), any());
280280

0 commit comments

Comments
 (0)