Skip to content

Commit 7ca2779

Browse files
committed
Polishing.
Reformat code.
1 parent 2809186 commit 7ca2779

File tree

2 files changed

+36
-45
lines changed

2 files changed

+36
-45
lines changed

src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,13 @@ public static class BitFieldSet extends AbstractBitFieldSubCommand {
648648
* @return
649649
* @since 2.5.2
650650
*/
651-
public static BitFieldSet create(BitFieldType type,Offset offset,long value){
651+
public static BitFieldSet create(BitFieldType type, Offset offset, long value) {
652652

653653
Assert.notNull(type, "BitFieldType must not be null");
654654
Assert.notNull(offset, "Offset must not be null");
655655

656656
BitFieldSet instance = new BitFieldSet();
657-
instance.type = type;
657+
instance.type = type;
658658
instance.offset = offset;
659659
instance.value = value;
660660

@@ -728,13 +728,13 @@ public static class BitFieldGet extends AbstractBitFieldSubCommand {
728728
* @since 2.5.2
729729
* @return
730730
*/
731-
public static BitFieldGet create(BitFieldType type,Offset offset){
731+
public static BitFieldGet create(BitFieldType type, Offset offset) {
732732

733733
Assert.notNull(type, "BitFieldType must not be null");
734734
Assert.notNull(offset, "Offset must not be null");
735735

736736
BitFieldGet instance = new BitFieldGet();
737-
instance.type = type;
737+
instance.type = type;
738738
instance.offset = offset;
739739

740740
return instance;
@@ -767,7 +767,7 @@ public static class BitFieldIncrBy extends AbstractBitFieldSubCommand {
767767
* @return
768768
* @since 2.5.2
769769
*/
770-
public static BitFieldIncrBy create(BitFieldType type,Offset offset,long value){
770+
public static BitFieldIncrBy create(BitFieldType type, Offset offset, long value) {
771771
return create(type, offset, value, null);
772772
}
773773

@@ -787,7 +787,7 @@ public static BitFieldIncrBy create(BitFieldType type, Offset offset, long value
787787
Assert.notNull(offset, "Offset must not be null");
788788

789789
BitFieldIncrBy instance = new BitFieldIncrBy();
790-
instance.type = type;
790+
instance.type = type;
791791
instance.offset = offset;
792792
instance.value = value;
793793
instance.overflow = overflow;

src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java

+30-39
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public abstract class AbstractConnectionIntegrationTests {
132132

133133
protected List<Object> actual = new ArrayList<>();
134134

135-
@Autowired @EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
135+
@Autowired
136+
@EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
136137

137138
protected RedisConnection byteConnection;
138139

@@ -588,8 +589,7 @@ public void testNullKey() {
588589
try {
589590
connection.decr((String) null);
590591
fail("Decrement should fail with null key");
591-
} catch (Exception expected) {
592-
}
592+
} catch (Exception expected) {}
593593
}
594594

595595
@Test
@@ -601,8 +601,7 @@ public void testNullValue() {
601601
try {
602602
connection.append(key, null);
603603
fail("Append should fail with null value");
604-
} catch (DataAccessException expected) {
605-
}
604+
} catch (DataAccessException expected) {}
606605
}
607606

608607
@Test
@@ -613,8 +612,7 @@ public void testHashNullKey() {
613612
try {
614613
connection.hExists(key, null);
615614
fail("hExists should fail with null key");
616-
} catch (DataAccessException expected) {
617-
}
615+
} catch (DataAccessException expected) {}
618616
}
619617

620618
@Test
@@ -627,8 +625,7 @@ public void testHashNullValue() {
627625
try {
628626
connection.hSet(key, field, null);
629627
fail("hSet should fail with null value");
630-
} catch (DataAccessException expected) {
631-
}
628+
} catch (DataAccessException expected) {}
632629
}
633630

634631
@Test
@@ -665,8 +662,7 @@ public void testPubSubWithNamedChannels() throws Exception {
665662

666663
try {
667664
Thread.sleep(500);
668-
} catch (InterruptedException ignore) {
669-
}
665+
} catch (InterruptedException ignore) {}
670666

671667
// open a new connection
672668
RedisConnection connection2 = connectionFactory.getConnection();
@@ -709,8 +705,7 @@ public void testPubSubWithPatterns() throws Exception {
709705

710706
try {
711707
Thread.sleep(500);
712-
} catch (InterruptedException ignore) {
713-
}
708+
} catch (InterruptedException ignore) {}
714709

715710
// open a new connection
716711
RedisConnection connection2 = connectionFactory.getConnection();
@@ -2641,8 +2636,7 @@ void scanShouldReadEntireValueRange() {
26412636
void scanWithType() {
26422637

26432638
assumeThat(isPipelinedOrQueueingConnection(connection))
2644-
.describedAs("SCAN is only available in non-pipeline | non-queueing mode")
2645-
.isFalse();
2639+
.describedAs("SCAN is only available in non-pipeline | non-queueing mode").isFalse();
26462640

26472641
connection.set("key", "data");
26482642
connection.lPush("list", "foo");
@@ -2669,7 +2663,8 @@ private static List<String> toList(Cursor<byte[]> cursor) {
26692663
public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() {
26702664

26712665
byteConnection.openPipeline();
2672-
IntStream.range(0, 100).forEach(it -> byteConnection.stringCommands().set("key:%s".formatted(it).getBytes(StandardCharsets.UTF_8), "data".getBytes(StandardCharsets.UTF_8)));
2666+
IntStream.range(0, 100).forEach(it -> byteConnection.stringCommands()
2667+
.set("key:%s".formatted(it).getBytes(StandardCharsets.UTF_8), "data".getBytes(StandardCharsets.UTF_8)));
26732668
byteConnection.closePipeline();
26742669

26752670
Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match("key*9").count(10).build());
@@ -3364,8 +3359,7 @@ void geoSearchShouldConsiderDistanceCorrectly() {
33643359
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
33653360

33663361
actual.add(
3367-
connection.geoSearch(key, GeoReference.fromMember(PALERMO),
3368-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3362+
connection.geoSearch(key, GeoReference.fromMember(PALERMO), GeoShape.byRadius(new Distance(200, KILOMETERS)),
33693363
newGeoSearchArgs().limit(2).includeDistance().includeCoordinates()));
33703364

33713365
List<Object> results = getResults();
@@ -3383,8 +3377,7 @@ void geoSearchStoreByMemberShouldStoreResult() {
33833377
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
33843378

33853379
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromMember(PALERMO),
3386-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3387-
newGeoSearchStoreArgs().limit(2).storeDistance()));
3380+
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
33883381
actual.add(connection.zScore("georesults", PALERMO.getName()));
33893382
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
33903383

@@ -3402,8 +3395,7 @@ void geoSearchStoreByPointShouldStoreResult() {
34023395
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
34033396

34043397
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromCoordinate(PALERMO),
3405-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3406-
newGeoSearchStoreArgs().limit(2).storeDistance()));
3398+
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
34073399
actual.add(connection.zScore("georesults", PALERMO.getName()));
34083400
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
34093401

@@ -3580,22 +3572,21 @@ void bitFieldIncrByWithOverflowShouldWorkCorrectly() {
35803572
assertThat(results.get(3)).isNotNull();
35813573
}
35823574

3583-
@ParameterizedTest // DATAREDIS-2903
3584-
@ValueSource(booleans = {false, true})
3585-
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
3586-
var offset = isMultipliedByTypeLengthOffset
3587-
? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
3588-
: BitFieldSubCommands.Offset.offset(400L);
3575+
@ParameterizedTest // GH-2903
3576+
@ValueSource(booleans = { false, true })
3577+
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
35893578

3590-
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
3591-
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
3579+
var offset = isMultipliedByTypeLengthOffset ? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
3580+
: BitFieldSubCommands.Offset.offset(400L);
35923581

3593-
List<Object> results = getResults();
3582+
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
3583+
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
35943584

3595-
assertThat(results).hasSize(2)
3596-
// should return same results after INCRBY and GET operations for bitfield with same offset
3597-
.containsExactly(List.of(1L), List.of(1L));
3598-
}
3585+
List<Object> results = getResults();
3586+
3587+
// should return same results after INCRBY and GET operations for bitfield with same offset
3588+
assertThat(results).containsExactly(List.of(1L), List.of(1L));
3589+
}
35993590

36003591
@Test // DATAREDIS-562
36013592
void bitfieldShouldAllowMultipleSubcommands() {
@@ -3884,8 +3875,8 @@ public void xPendingShouldLoadPendingMessagesForConsumer() {
38843875
actual.add(connection.xReadGroupAsString(Consumer.from("my-group", "my-consumer"),
38853876
StreamOffset.create(KEY_1, ReadOffset.lastConsumed())));
38863877

3887-
actual.add(connection.xPending(KEY_1, "my-group", "my-consumer",
3888-
org.springframework.data.domain.Range.unbounded(), 10L));
3878+
actual.add(
3879+
connection.xPending(KEY_1, "my-group", "my-consumer", org.springframework.data.domain.Range.unbounded(), 10L));
38893880

38903881
List<Object> results = getResults();
38913882
assertThat(results).hasSize(4);
@@ -4106,7 +4097,7 @@ public void xinfoConsumersNoConsumer() {
41064097
assertThat(info.size()).isZero();
41074098
}
41084099

4109-
@Test //GH-2345
4100+
@Test // GH-2345
41104101
public void zRangeStoreByScoreStoresKeys() {
41114102
String dstKey = KEY_2;
41124103
String srcKey = KEY_1;
@@ -4144,7 +4135,7 @@ public void zRangeStoreRevByScoreStoresKeys() {
41444135
assertThat((LinkedHashSet<Object>) result.get(5)).containsSequence(VALUE_3, VALUE_4);
41454136
}
41464137

4147-
@Test //GH-2345
4138+
@Test // GH-2345
41484139
public void zRangeStoreByLexStoresKeys() {
41494140
String dstKey = KEY_2;
41504141
String srcKey = KEY_1;

0 commit comments

Comments
 (0)