use of io.lettuce.core.codec.StringCodec in project lettuce-core by lettuce-io.
the class CommandSegmentCommandFactoryUnitTests method setKeyValueWithHintedValue.
@Test
void setKeyValueWithHintedValue() {
RedisCommand<?, ?, ?> command = createCommand(methodOf(Commands.class, "set2", String.class, String.class), new StringCodec(), "key", "value");
assertThat(toString(command)).isEqualTo("SET key<key> value<value>");
assertThat(command.getType()).isSameAs(CommandType.SET);
}
use of io.lettuce.core.codec.StringCodec in project lettuce-core by lettuce-io.
the class CommandSegmentCommandFactoryUnitTests method varargsMethodWithParameterIndexAccess.
@Test
void varargsMethodWithParameterIndexAccess() {
RedisCommand<?, ?, ?> command = createCommand(methodOf(Commands.class, "varargsWithParamIndexes", ScanArgs.class, String[].class), new StringCodec(), ScanArgs.Builder.limit(1), new String[] { "a", "b" });
assertThat(toString(command)).isEqualTo("MGET a b COUNT 1");
}
use of io.lettuce.core.codec.StringCodec in project lettuce-core by lettuce-io.
the class CommandSegmentCommandFactoryUnitTests method asyncWithTimeout.
@Test
void asyncWithTimeout() {
try {
createCommand(methodOf(MethodsWithTimeout.class, "async", String.class, Timeout.class), new StringCodec());
fail("Missing CommandCreationException");
} catch (CommandCreationException e) {
assertThat(e).hasMessageContaining("Asynchronous command methods do not support Timeout parameters");
}
}
use of io.lettuce.core.codec.StringCodec in project lettuce-core by lettuce-io.
the class CommandSegmentCommandFactoryUnitTests method resolvesUnknownCommandToStringBackedCommandType.
@Test
void resolvesUnknownCommandToStringBackedCommandType() {
RedisCommand<?, ?, ?> command = createCommand(methodOf(Commands.class, "unknownCommand"), new StringCodec());
assertThat(toString(command)).isEqualTo("XYZ");
assertThat(command.getType()).isNotInstanceOf(CommandType.class);
}
use of io.lettuce.core.codec.StringCodec in project lettuce-core by lettuce-io.
the class ParameterBinderUnitTests method bind.
private CommandArgs<String, String> bind(CommandMethod commandMethod, Object object) {
DefaultMethodParametersAccessor parametersAccessor = new DefaultMethodParametersAccessor(commandMethod.getParameters(), object);
CommandArgs<String, String> args = new CommandArgs<>(new StringCodec());
binder.bind(args, StringCodec.UTF8, segments, parametersAccessor);
return args;
}
Aggregations