From fca3851fca178be36580b9bda97a2a5927eb7f43 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Thu, 12 Sep 2024 11:28:36 -0700 Subject: [PATCH] Java: Add script show unit test for basic strings (#2283) Add script show unit test for basic strings Signed-off-by: Andrew Carbonetto --- .../test/java/glide/api/GlideClientTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/java/client/src/test/java/glide/api/GlideClientTest.java b/java/client/src/test/java/glide/api/GlideClientTest.java index e1e6a530a2..f9aa61daeb 100644 --- a/java/client/src/test/java/glide/api/GlideClientTest.java +++ b/java/client/src/test/java/glide/api/GlideClientTest.java @@ -1582,6 +1582,27 @@ public void invokeScript_with_ScriptOptionsGlideString_returns_success() { assertEquals(payload, response.get()); } + @SneakyThrows + @Test + public void scriptShow_returns_script_source() { + // setup + String scriptSource = "return { KEYS[1], ARGV[1] }"; + String hash = UUID.randomUUID().toString(); + + CompletableFuture testResponse = new CompletableFuture<>(); + testResponse.complete(scriptSource); + + when(commandManager.submitNewCommand(eq(ScriptShow), eq(new String[] {hash}), any())) + .thenReturn(testResponse); + + // exercise + CompletableFuture response = service.scriptShow(hash); + + // verify + assertEquals(testResponse, response); + assertEquals(scriptSource, response.get()); + } + @SneakyThrows @Test public void scriptShow_returns_script_source_glidestring() {