diff --git a/common/src/test/java/org/opensearch/ml/common/TestHelper.java b/common/src/test/java/org/opensearch/ml/common/TestHelper.java index e1c5c9d03d..baa40f9102 100644 --- a/common/src/test/java/org/opensearch/ml/common/TestHelper.java +++ b/common/src/test/java/org/opensearch/ml/common/TestHelper.java @@ -36,7 +36,7 @@ public static void testParse(ToXContentObject obj, Function nodeErrors) throws IOExcep builder.field(entry.getKey(), entry.getValue()); } builder.endObject(); - return Strings.toString(builder); + return builder.toString(); } public static void logException(String errorMessage, Exception e, Logger log) { diff --git a/plugin/src/test/java/org/opensearch/ml/utils/IntegTestUtils.java b/plugin/src/test/java/org/opensearch/ml/utils/IntegTestUtils.java index c97994c5be..511cad9655 100644 --- a/plugin/src/test/java/org/opensearch/ml/utils/IntegTestUtils.java +++ b/plugin/src/test/java/org/opensearch/ml/utils/IntegTestUtils.java @@ -196,7 +196,7 @@ public static void predictAndVerifyResult(String taskId, MLInputDataset inputDat MLPredictionOutput mlPredictionOutput = (MLPredictionOutput) predictionResponse.getOutput(); mlPredictionOutput.getPredictionResult().toXContent(builder, ToXContent.EMPTY_PARAMS); builder.endObject(); - String jsonStr = org.opensearch.common.Strings.toString(builder); + String jsonStr = builder.toString(); String expectedStr1 = "{\"column_metas\":[{\"name\":\"ClusterID\",\"column_type\":\"INTEGER\"}]," + "\"rows\":[{\"values\":[{\"column_type\":\"INTEGER\",\"value\":0}]}]}"; String expectedStr2 = "{\"column_metas\":[{\"name\":\"ClusterID\",\"column_type\":\"INTEGER\"}],"