Skip to content

Commit 811a01f

Browse files
committed
Fix tests with param index and eq rather than raw strings
Signed-off-by: Daniel Widdis <[email protected]>
1 parent 82ab71c commit 811a01f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/test/java/org/opensearch/flowframework/transport/SearchWorkflowStateTransportActionTests.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.opensearch.transport.client.Client;
2525

2626
import static org.mockito.ArgumentMatchers.any;
27+
import static org.mockito.ArgumentMatchers.eq;
2728
import static org.mockito.ArgumentMatchers.nullable;
2829
import static org.mockito.Mockito.doAnswer;
2930
import static org.mockito.Mockito.mock;
@@ -66,13 +67,18 @@ public void testSearchWorkflow() {
6667

6768
doAnswer(invocation -> {
6869
SearchRequest request = invocation.getArgument(0);
69-
ActionListener<SearchResponse> responseListener = invocation.getArgument(1);
70+
ActionListener<SearchResponse> responseListener = invocation.getArgument(3);
7071
ThreadContext.StoredContext storedContext = mock(ThreadContext.StoredContext.class);
7172
searchHandler.validateRole(request, null, null, null, responseListener, storedContext);
7273
responseListener.onResponse(mock(SearchResponse.class));
7374
return null;
7475
}).when(searchHandler)
75-
.search(any(SearchRequest.class), nullable(String.class), CommonValue.WORKFLOW_STATE_RESOURCE_TYPE, any(ActionListener.class));
76+
.search(
77+
any(SearchRequest.class),
78+
nullable(String.class),
79+
eq(CommonValue.WORKFLOW_STATE_RESOURCE_TYPE),
80+
any(ActionListener.class)
81+
);
7682

7783
doAnswer(invocation -> {
7884
ActionListener<SearchResponse> responseListener = invocation.getArgument(1);
@@ -84,7 +90,7 @@ public void testSearchWorkflow() {
8490
verify(searchHandler).search(
8591
any(SearchRequest.class),
8692
nullable(String.class),
87-
CommonValue.WORKFLOW_RESOURCE_TYPE,
93+
eq(CommonValue.WORKFLOW_STATE_RESOURCE_TYPE),
8894
any(ActionListener.class)
8995
);
9096
}

src/test/java/org/opensearch/flowframework/transport/SearchWorkflowTransportActionTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.opensearch.transport.client.Client;
2525

2626
import static org.mockito.ArgumentMatchers.any;
27+
import static org.mockito.ArgumentMatchers.eq;
2728
import static org.mockito.ArgumentMatchers.nullable;
2829
import static org.mockito.Mockito.doAnswer;
2930
import static org.mockito.Mockito.mock;
@@ -70,13 +71,13 @@ public void testSearchWorkflow() {
7071

7172
doAnswer(invocation -> {
7273
SearchRequest request = invocation.getArgument(0);
73-
ActionListener<SearchResponse> responseListener = invocation.getArgument(1);
74+
ActionListener<SearchResponse> responseListener = invocation.getArgument(3);
7475
ThreadContext.StoredContext storedContext = mock(ThreadContext.StoredContext.class);
7576
searchHandler.validateRole(request, null, null, null, responseListener, storedContext);
7677
responseListener.onResponse(mock(SearchResponse.class));
7778
return null;
7879
}).when(searchHandler)
79-
.search(any(SearchRequest.class), nullable(String.class), CommonValue.WORKFLOW_RESOURCE_TYPE, any(ActionListener.class));
80+
.search(any(SearchRequest.class), nullable(String.class), eq(CommonValue.WORKFLOW_RESOURCE_TYPE), any(ActionListener.class));
8081

8182
doAnswer(invocation -> {
8283
ActionListener<SearchResponse> responseListener = invocation.getArgument(1);
@@ -88,7 +89,7 @@ public void testSearchWorkflow() {
8889
verify(searchHandler).search(
8990
any(SearchRequest.class),
9091
nullable(String.class),
91-
CommonValue.WORKFLOW_RESOURCE_TYPE,
92+
eq(CommonValue.WORKFLOW_RESOURCE_TYPE),
9293
any(ActionListener.class)
9394
);
9495
}

0 commit comments

Comments
 (0)