diff --git a/memory/src/test/java/org/opensearch/ml/memory/index/InteractionsIndexTests.java b/memory/src/test/java/org/opensearch/ml/memory/index/InteractionsIndexTests.java index 54ec44df77..2d4184eec3 100644 --- a/memory/src/test/java/org/opensearch/ml/memory/index/InteractionsIndexTests.java +++ b/memory/src/test/java/org/opensearch/ml/memory/index/InteractionsIndexTests.java @@ -63,9 +63,6 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.SendRequestTransportException; -import lombok.extern.log4j.Log4j2; - -@Log4j2 public class InteractionsIndexTests extends OpenSearchTestCase { @Mock Client client; diff --git a/memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java b/memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java index 175949b0ef..c8df948bcb 100644 --- a/memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java +++ b/memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java @@ -25,6 +25,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.time.Instant; import java.util.List; import org.junit.Before; @@ -268,4 +269,26 @@ public void testSearchInteractions_Future() { ActionFuture result = cmHandler.searchInteractions(cid, request); assert (result.actionGet().equals(response)); } + + public void testGetAConversation_Future() { + ConversationMeta response = new ConversationMeta("cid", Instant.now(), "boring name", null); + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(response); + return null; + }).when(conversationMetaIndex).getConversation(any(), any()); + ActionFuture result = cmHandler.getConversation("cid"); + assert (result.actionGet().equals(response)); + } + + public void testGetAnInteraction_Future() { + Interaction interaction = new Interaction("iid", Instant.now(), "cid", "inp", "pt", "rsp", "ogn", "extra"); + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(2); + listener.onResponse(interaction); + return null; + }).when(interactionsIndex).getInteraction(any(), any(), any()); + ActionFuture result = cmHandler.getInteraction("cid", "iid"); + assert (result.actionGet().equals(interaction)); + } }