From 1e2d50d832aa972b04593559507a47f16419ef23 Mon Sep 17 00:00:00 2001 From: Aurelien FOUCRET Date: Mon, 27 May 2024 16:40:53 +0200 Subject: [PATCH] Replace forbidden API call in tests. --- .../xpack/ml/integration/LearningToRankRescorerIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java index 3c4e2f05d9340..2d63b5c4b83d8 100644 --- a/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java +++ b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java @@ -10,6 +10,7 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.junit.Before; @@ -272,14 +273,14 @@ public void testLearningToRankRescorerWithChainedRescorers() throws IOException { Request request = new Request("GET", "store/_search?size=4"); - request.setJsonEntity(String.format(queryTemplate, randomIntBetween(2, 10000), randomIntBetween(4, 5))); + request.setJsonEntity(Strings.format(queryTemplate, randomIntBetween(2, 10000), randomIntBetween(4, 5))); assertHitScores(client().performRequest(request), List.of(40.0, 40.0, 37.0, 29.0)); } { int lastRescorerWindowSize = randomIntBetween(6, 10000); Request request = new Request("GET", "store/_search?size=4"); - request.setJsonEntity(String.format(queryTemplate, randomIntBetween(2, 10000), lastRescorerWindowSize)); + request.setJsonEntity(Strings.format(queryTemplate, randomIntBetween(2, 10000), lastRescorerWindowSize)); Exception e = assertThrows(ResponseException.class, () -> client().performRequest(request)); assertThat(