Skip to content

Commit

Permalink
Java: Add script show unit test for basic strings (#2283)
Browse files Browse the repository at this point in the history
Add script show unit test for basic strings

Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
  • Loading branch information
acarbonetto authored Sep 12, 2024
1 parent 13a2a86 commit fca3851
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions java/client/src/test/java/glide/api/GlideClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> testResponse = new CompletableFuture<>();
testResponse.complete(scriptSource);

when(commandManager.<String>submitNewCommand(eq(ScriptShow), eq(new String[] {hash}), any()))
.thenReturn(testResponse);

// exercise
CompletableFuture<String> response = service.scriptShow(hash);

// verify
assertEquals(testResponse, response);
assertEquals(scriptSource, response.get());
}

@SneakyThrows
@Test
public void scriptShow_returns_script_source_glidestring() {
Expand Down

0 comments on commit fca3851

Please sign in to comment.