From bf3fcb79230782b83e34c8e3cdee74beba2e5ecb Mon Sep 17 00:00:00 2001 From: Matteo Piergiovanni <134913285+piergm@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:53:52 +0100 Subject: [PATCH] fix testMaybeConvertToBytesRefStringCorrectSize (#116386) --- .../elasticsearch/index/query/AbstractQueryBuilderTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/query/AbstractQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/AbstractQueryBuilderTests.java index a43c1a8ba3395..72fe6aaa7154a 100644 --- a/server/src/test/java/org/elasticsearch/index/query/AbstractQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/AbstractQueryBuilderTests.java @@ -100,10 +100,10 @@ public void testMaybeConvertToBytesRefStringCorrectSize() { int correctSize = 0; for (int i = 0; i < capacity; i++) { if (i < capacity / 3) { - termBuilder.append((char) randomIntBetween(0, 128)); + termBuilder.append((char) randomIntBetween(0, 127)); ++correctSize; // use only one byte for char < 128 } else if (i < 2 * capacity / 3) { - termBuilder.append((char) randomIntBetween(128, 2048)); + termBuilder.append((char) randomIntBetween(128, 2047)); correctSize += 2; // use two bytes for char < 2048 } else { termBuilder.append((char) randomIntBetween(2048, 4092));