Skip to content

Commit

Permalink
Polishing #1451
Browse files Browse the repository at this point in the history
Guard tests so they run only with Redis 6.2. Reformat code.

Original pull request: #1455.
  • Loading branch information
mp911de committed Oct 26, 2020
1 parent 5810f96 commit b240c58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/io/lettuce/core/ZAddArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static ZAddArgs gt() {
public static ZAddArgs lt() {
return new ZAddArgs().lt();
}

}

/**
Expand Down Expand Up @@ -136,7 +137,8 @@ public ZAddArgs ch() {
}

/**
* Only update existing elements if the new score is greater than the current score. This flag doesn't prevent adding new elements.
* Only update existing elements if the new score is greater than the current score. This flag doesn't prevent adding new
* elements.
*
* @return {@code this} {@link ZAddArgs}.
* @since 6.1
Expand All @@ -149,7 +151,8 @@ public ZAddArgs gt() {
}

/**
* Only update existing elements if the new score is less than the current score. This flag doesn't prevent adding new elements.
* Only update existing elements if the new score is less than the current score. This flag doesn't prevent adding new
* elements.
*
* @return {@code this} {@link ZAddArgs}.
* @since 6.1
Expand All @@ -174,6 +177,7 @@ public <K, V> void build(CommandArgs<K, V> args) {
if (gt) {
args.add("GT");
}

if (lt) {
args.add("LT");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@
import io.lettuce.test.condition.EnabledOnCommand;

/**
* Integration tests for Sorted Sets via {@link io.lettuce.core.api.sync.RedisSortedSetCommands}.
*
* @author Will Glozer
* @author Mark Paluch
* @author dengliming
*/
@ExtendWith(LettuceExtension.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down Expand Up @@ -797,6 +800,7 @@ void setup100KeyValues(Set<String> expect) {
}

@Test
@EnabledOnCommand("ZMSCORE") // Redis 6.2
void zaddgt() {
assertThat(redis.zadd(key, 1.0, "a")).isEqualTo(1);
// new score less than the current score
Expand All @@ -813,6 +817,7 @@ void zaddgt() {
}

@Test
@EnabledOnCommand("ZMSCORE") // Redis 6.2
void zaddlt() {
assertThat(redis.zadd(key, 2.0, "a")).isEqualTo(1);
// new score greater than the current score
Expand Down

0 comments on commit b240c58

Please sign in to comment.