Skip to content

Commit 0a72217

Browse files
authored
Use Strings#EMPTY_ARRAY (#79452)
Trivial follow-up to #79351 that introduced some spots that create fresh empty string arrays.
1 parent 3dc00db commit 0a72217

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
@@ -173,7 +173,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenShardInitializationPen
173173
doAnswer(invocationOnMock -> {
174174
@SuppressWarnings("unchecked")
175175
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
176-
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
176+
listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
177177
return null;
178178
}).when(clusterClient).health(any(), any());
179179

@@ -257,7 +257,7 @@ public void testCreateLatestVersionedIndexIfRequired_GivenConcurrentCreationShar
257257
doAnswer(invocationOnMock -> {
258258
@SuppressWarnings("unchecked")
259259
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) invocationOnMock.getArguments()[1];
260-
listener.onResponse(new ClusterHealthResponse("", new String[]{}, ClusterState.EMPTY_STATE, false));
260+
listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false));
261261
return null;
262262
}).when(clusterClient).health(any(), any());
263263

0 commit comments

Comments
 (0)