diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java index e9b66343dd..8506c7a1e5 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java @@ -5,7 +5,6 @@ package org.opensearch.sql.legacy.unittest.cursor; -import static java.util.Collections.emptyList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.emptyOrNullString; import static org.hamcrest.Matchers.startsWith; @@ -17,13 +16,10 @@ import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.opensearch.action.support.ActionFilters; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.search.builder.SearchSourceBuilder; @@ -31,15 +27,12 @@ import org.opensearch.sql.legacy.cursor.CursorType; import org.opensearch.sql.legacy.cursor.DefaultCursor; import org.opensearch.sql.legacy.esdomain.LocalClusterState; -import org.opensearch.sql.legacy.metrics.Metrics; import org.opensearch.sql.opensearch.setting.OpenSearchSettings; public class DefaultCursorTest { - @Mock - private OpenSearchSettings settings; + @Mock private OpenSearchSettings settings; - @Mock - private SearchSourceBuilder sourceBuilder; + @Mock private SearchSourceBuilder sourceBuilder; @Before public void setUp() { diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java index b82a014639..ec6ab00f97 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java @@ -9,25 +9,17 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; -import static org.mockito.Mockito.when; -import java.io.ByteArrayOutputStream; import java.util.*; - import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; import org.opensearch.action.search.SearchRequestBuilder; import org.opensearch.client.Client; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.script.Script; -import org.opensearch.search.builder.SearchSourceBuilder; import org.opensearch.search.sort.FieldSortBuilder; import org.opensearch.search.sort.SortOrder; import org.opensearch.sql.common.setting.Settings; @@ -41,7 +33,6 @@ import org.opensearch.sql.legacy.metrics.Metrics; import org.opensearch.sql.legacy.query.DefaultQueryAction; import org.opensearch.sql.legacy.request.SqlRequest; -import org.opensearch.sql.opensearch.setting.OpenSearchSettings; public class DefaultQueryActionTest { @@ -268,7 +259,9 @@ private void mockLocalClusterStateAndInitializeMetrics(TimeValue time) { .when(mockLocalClusterState) .getSettingValue(Settings.Key.METRICS_ROLLING_WINDOW); doReturn(2L).when(mockLocalClusterState).getSettingValue(Settings.Key.METRICS_ROLLING_INTERVAL); - doReturn(true).when(mockLocalClusterState).getSettingValue(Settings.Key.SQL_PAGINATION_API_SEARCH_AFTER); + doReturn(true) + .when(mockLocalClusterState) + .getSettingValue(Settings.Key.SQL_PAGINATION_API_SEARCH_AFTER); Metrics.getInstance().registerDefaultMetrics(); } @@ -278,10 +271,12 @@ private void mockLocalClusterStateAndIntializeMetricsForScroll(TimeValue time) { LocalClusterState.state(mockLocalClusterState); doReturn(time).when(mockLocalClusterState).getSettingValue(Settings.Key.SQL_CURSOR_KEEP_ALIVE); doReturn(3600L) - .when(mockLocalClusterState) - .getSettingValue(Settings.Key.METRICS_ROLLING_WINDOW); + .when(mockLocalClusterState) + .getSettingValue(Settings.Key.METRICS_ROLLING_WINDOW); doReturn(2L).when(mockLocalClusterState).getSettingValue(Settings.Key.METRICS_ROLLING_INTERVAL); - doReturn(false).when(mockLocalClusterState).getSettingValue(Settings.Key.SQL_PAGINATION_API_SEARCH_AFTER); + doReturn(false) + .when(mockLocalClusterState) + .getSettingValue(Settings.Key.SQL_PAGINATION_API_SEARCH_AFTER); Metrics.getInstance().registerDefaultMetrics(); }