Polishing.

Reformat code.
This commit is contained in:
Mark Paluch
2024-05-13 15:09:00 +02:00
parent a77df79f44
commit f862b9240e
2 changed files with 34 additions and 44 deletions

View File

@@ -648,13 +648,13 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
* @return
* @since 2.5.2
*/
public static BitFieldSet create(BitFieldType type,Offset offset,long value){
public static BitFieldSet create(BitFieldType type, Offset offset, long value) {
Assert.notNull(type, "BitFieldType must not be null");
Assert.notNull(offset, "Offset must not be null");
BitFieldSet instance = new BitFieldSet();
instance.type = type;
instance.type = type;
instance.offset = offset;
instance.value = value;
@@ -728,13 +728,13 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
* @since 2.5.2
* @return
*/
public static BitFieldGet create(BitFieldType type,Offset offset){
public static BitFieldGet create(BitFieldType type, Offset offset) {
Assert.notNull(type, "BitFieldType must not be null");
Assert.notNull(offset, "Offset must not be null");
BitFieldGet instance = new BitFieldGet();
instance.type = type;
instance.type = type;
instance.offset = offset;
return instance;
@@ -767,7 +767,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
* @return
* @since 2.5.2
*/
public static BitFieldIncrBy create(BitFieldType type,Offset offset,long value){
public static BitFieldIncrBy create(BitFieldType type, Offset offset, long value) {
return create(type, offset, value, null);
}
@@ -787,7 +787,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
Assert.notNull(offset, "Offset must not be null");
BitFieldIncrBy instance = new BitFieldIncrBy();
instance.type = type;
instance.type = type;
instance.offset = offset;
instance.value = value;
instance.overflow = overflow;

View File

@@ -130,7 +130,8 @@ public abstract class AbstractConnectionIntegrationTests {
protected List<Object> actual = new ArrayList<>();
@Autowired @EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
@Autowired
@EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
protected RedisConnection byteConnection;
@@ -586,8 +587,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
connection.decr((String) null);
fail("Decrement should fail with null key");
} catch (Exception expected) {
}
} catch (Exception expected) {}
}
@Test
@@ -599,8 +599,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
connection.append(key, null);
fail("Append should fail with null value");
} catch (DataAccessException expected) {
}
} catch (DataAccessException expected) {}
}
@Test
@@ -611,8 +610,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
connection.hExists(key, null);
fail("hExists should fail with null key");
} catch (DataAccessException expected) {
}
} catch (DataAccessException expected) {}
}
@Test
@@ -625,8 +623,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
connection.hSet(key, field, null);
fail("hSet should fail with null value");
} catch (DataAccessException expected) {
}
} catch (DataAccessException expected) {}
}
@Test
@@ -663,8 +660,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
Thread.sleep(500);
} catch (InterruptedException ignore) {
}
} catch (InterruptedException ignore) {}
// open a new connection
RedisConnection connection2 = connectionFactory.getConnection();
@@ -707,8 +703,7 @@ public abstract class AbstractConnectionIntegrationTests {
try {
Thread.sleep(500);
} catch (InterruptedException ignore) {
}
} catch (InterruptedException ignore) {}
// open a new connection
RedisConnection connection2 = connectionFactory.getConnection();
@@ -2639,8 +2634,7 @@ public abstract class AbstractConnectionIntegrationTests {
void scanWithType() {
assumeThat(isPipelinedOrQueueingConnection(connection))
.describedAs("SCAN is only available in non-pipeline | non-queueing mode")
.isFalse();
.describedAs("SCAN is only available in non-pipeline | non-queueing mode").isFalse();
connection.set("key", "data");
connection.lPush("list", "foo");
@@ -3361,8 +3355,7 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
actual.add(
connection.geoSearch(key, GeoReference.fromMember(PALERMO),
GeoShape.byRadius(new Distance(200, KILOMETERS)),
connection.geoSearch(key, GeoReference.fromMember(PALERMO), GeoShape.byRadius(new Distance(200, KILOMETERS)),
newGeoSearchArgs().limit(2).includeDistance().includeCoordinates()));
List<Object> results = getResults();
@@ -3380,8 +3373,7 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromMember(PALERMO),
GeoShape.byRadius(new Distance(200, KILOMETERS)),
newGeoSearchStoreArgs().limit(2).storeDistance()));
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
actual.add(connection.zScore("georesults", PALERMO.getName()));
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
@@ -3399,8 +3391,7 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromCoordinate(PALERMO),
GeoShape.byRadius(new Distance(200, KILOMETERS)),
newGeoSearchStoreArgs().limit(2).storeDistance()));
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
actual.add(connection.zScore("georesults", PALERMO.getName()));
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
@@ -3577,22 +3568,21 @@ public abstract class AbstractConnectionIntegrationTests {
assertThat(results.get(3)).isNotNull();
}
@ParameterizedTest // DATAREDIS-2903
@ValueSource(booleans = {false, true})
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
var offset = isMultipliedByTypeLengthOffset
? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
: BitFieldSubCommands.Offset.offset(400L);
@ParameterizedTest // GH-2903
@ValueSource(booleans = { false, true })
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
var offset = isMultipliedByTypeLengthOffset ? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
: BitFieldSubCommands.Offset.offset(400L);
List<Object> results = getResults();
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
assertThat(results).hasSize(2)
// should return same results after INCRBY and GET operations for bitfield with same offset
.containsExactly(List.of(1L), List.of(1L));
}
List<Object> results = getResults();
// should return same results after INCRBY and GET operations for bitfield with same offset
assertThat(results).containsExactly(List.of(1L), List.of(1L));
}
@Test // DATAREDIS-562
void bitfieldShouldAllowMultipleSubcommands() {
@@ -3881,8 +3871,8 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.xReadGroupAsString(Consumer.from("my-group", "my-consumer"),
StreamOffset.create(KEY_1, ReadOffset.lastConsumed())));
actual.add(connection.xPending(KEY_1, "my-group", "my-consumer",
org.springframework.data.domain.Range.unbounded(), 10L));
actual.add(
connection.xPending(KEY_1, "my-group", "my-consumer", org.springframework.data.domain.Range.unbounded(), 10L));
List<Object> results = getResults();
assertThat(results).hasSize(4);
@@ -4103,7 +4093,7 @@ public abstract class AbstractConnectionIntegrationTests {
assertThat(info.size()).isZero();
}
@Test //GH-2345
@Test // GH-2345
public void zRangeStoreByScoreStoresKeys() {
String dstKey = KEY_2;
String srcKey = KEY_1;
@@ -4141,7 +4131,7 @@ public abstract class AbstractConnectionIntegrationTests {
assertThat((LinkedHashSet<Object>) result.get(5)).containsSequence(VALUE_3, VALUE_4);
}
@Test //GH-2345
@Test // GH-2345
public void zRangeStoreByLexStoresKeys() {
String dstKey = KEY_2;
String srcKey = KEY_1;