Skip to content

Commit

Permalink
Implement set(double) in NestedMultiOutput #1486
Browse files Browse the repository at this point in the history
NestedMultiOutput does not implement CommandOutput.set(double number) which causes problem with RediSearch FT.INFO command
  • Loading branch information
jruaux authored and sokomishalov committed Nov 4, 2020
1 parent 1cab728 commit 01f56f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/lettuce/core/output/NestedMultiOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* @param <V> Value type.
* @author Will Glozer
* @author Mark Paluch
* @author Julien Ruaux
*/
public class NestedMultiOutput<K, V> extends CommandOutput<K, V, List<Object>> {

Expand All @@ -57,6 +58,16 @@ public void set(long integer) {
output.add(integer);
}

@Override
public void set(double number) {

if (!initialized) {
output = new ArrayList<>();
}

output.add(number);
}

@Override
public void set(ByteBuffer bytes) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,15 @@ void nestedMultiError() {
output.setError(StandardCharsets.US_ASCII.encode("Oops!"));
assertThat(output.getError()).isNotNull();
}

@Test
void nestedMultiDouble() {
NestedMultiOutput<String, String> output = new NestedMultiOutput<>(StringCodec.UTF8);
double value = 123.456;
output.set(value);
assertThat(output.get()).isNotNull();
assertThat(output.get()).size().isEqualTo(1);
assertThat(output.get().get(0)).isEqualTo(value);
}

}

0 comments on commit 01f56f7

Please sign in to comment.