From 9e0b80e471935bc7e492d33f3e0304a1927d5b37 Mon Sep 17 00:00:00 2001 From: HenryL27 Date: Wed, 29 Nov 2023 11:17:28 -0800 Subject: [PATCH] accept past tense error message in getModel IT Signed-off-by: HenryL27 --- .../org/opensearch/ml/rest/RestMLGetModelActionIT.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMLGetModelActionIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMLGetModelActionIT.java index 9138f3827d..7f23077afa 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMLGetModelActionIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMLGetModelActionIT.java @@ -22,9 +22,12 @@ public class RestMLGetModelActionIT extends MLCommonsRestTestCase { public ExpectedException exceptionRule = ExpectedException.none(); public void testGetModelAPI_EmptyResources() throws IOException { - exceptionRule.expect(ResponseException.class); - exceptionRule.expectMessage("Fail to find model"); - TestHelper.makeRequest(client(), "GET", "/_plugins/_ml/models/111222333", null, "", null); + ResponseException e = assertThrows( + ResponseException.class, + () -> TestHelper.makeRequest(client(), "GET", "/_plugins/_ml/models/111222333", null, "", null) + ); + String msg = e.getMessage(); + assert (msg.contains("Fail to find model") || msg.contains("Failed to find model")); } @Ignore