diff --git a/src/test/java/org/opensearch/agent/tools/SearchAnomalyResultsToolTests.java b/src/test/java/org/opensearch/agent/tools/SearchAnomalyResultsToolTests.java index 0d3cc3d8..c9d83de2 100644 --- a/src/test/java/org/opensearch/agent/tools/SearchAnomalyResultsToolTests.java +++ b/src/test/java/org/opensearch/agent/tools/SearchAnomalyResultsToolTests.java @@ -8,6 +8,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.times; @@ -15,6 +16,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -65,6 +67,25 @@ public void setup() { nonEmptyParams = Map.of("detectorId", "foo"); } + @Test + public void testParseParams() throws Exception { + Tool tool = SearchAnomalyResultsTool.Factory.getInstance().create(Collections.emptyMap()); + Map validParams = new HashMap(); + validParams.put("detectorId", "foo"); + validParams.put("realTime", "true"); + validParams.put("anomalyGradethreshold", "-1"); + validParams.put("dataStartTime", "1234"); + validParams.put("dataEndTime", "5678"); + validParams.put("sortOrder", "AsC"); + validParams.put("sortString", "foo.bar"); + validParams.put("size", "10"); + validParams.put("startIndex", "0"); + + @SuppressWarnings("unchecked") + ActionListener listener = Mockito.mock(ActionListener.class); + assertDoesNotThrow(() -> tool.run(validParams, listener)); + } + @Test public void testRunWithInvalidAnomalyGradeParam() throws Exception { Tool tool = SearchAnomalyResultsTool.Factory.getInstance().create(Collections.emptyMap());