diff --git a/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java b/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java index 5aadd0383..a551b7638 100644 --- a/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java @@ -28,6 +28,7 @@ import org.springframework.util.Assert; * The actual {@code BITFIELD} command representation holding several {@link BitFieldSubCommand}s to execute. * * @author Christoph Strobl + * @author Qiang Lee * @since 2.1 */ public class BitFieldSubCommands implements Iterable { @@ -88,7 +89,7 @@ public class BitFieldSubCommands implements Iterable { /** * Create new {@link BitFieldSubCommands} adding given {@link BitFieldSet} to the sub commands. * - * @param get must not be {@literal null}. + * @param set must not be {@literal null}. * @return */ protected BitFieldSubCommands set(BitFieldSet set) { @@ -434,7 +435,7 @@ public class BitFieldSubCommands implements Iterable { private final boolean signed; private final int bits; - private BitFieldType(Boolean signed, Integer bits) { + private BitFieldType(boolean signed, Integer bits) { this.signed = signed; this.bits = bits; diff --git a/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java new file mode 100644 index 000000000..2d1eb09dc --- /dev/null +++ b/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.data.redis.connection; + +import static org.assertj.core.api.Assertions.*; + +import org.junit.Test; + +import org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldType; + +/** + * Unit tests for {@link BitFieldSubCommands}. + * + * @author Mark Paluch + */ +public class BitFieldSubCommandsUnitTests { + + @Test // DATAREDIS-971 + public void shouldCreateSignedBitFieldType() { + + BitFieldType type = BitFieldType.signed(10); + + assertThat(type.isSigned()).isTrue(); + assertThat(type.getBits()).isEqualTo(10); + } + + @Test // DATAREDIS-971 + public void shouldCreateUnsignedBitFieldType() { + + BitFieldType type = BitFieldType.unsigned(10); + + assertThat(type.isSigned()).isFalse(); + assertThat(type.getBits()).isEqualTo(10); + } +}