Skip to content

Commit f862b92

Browse files
committed
Polishing.
Reformat code.
1 parent a77df79 commit f862b92

File tree

2 files changed

+34
-44
lines changed

2 files changed

+34
-44
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

+28-38
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public abstract class AbstractConnectionIntegrationTests {
130130

131131
protected List<Object> actual = new ArrayList<>();
132132

133-
@Autowired @EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
133+
@Autowired
134+
@EnabledOnRedisDriver.DriverQualifier protected RedisConnectionFactory connectionFactory;
134135

135136
protected RedisConnection byteConnection;
136137

@@ -586,8 +587,7 @@ public void testNullKey() {
586587
try {
587588
connection.decr((String) null);
588589
fail("Decrement should fail with null key");
589-
} catch (Exception expected) {
590-
}
590+
} catch (Exception expected) {}
591591
}
592592

593593
@Test
@@ -599,8 +599,7 @@ public void testNullValue() {
599599
try {
600600
connection.append(key, null);
601601
fail("Append should fail with null value");
602-
} catch (DataAccessException expected) {
603-
}
602+
} catch (DataAccessException expected) {}
604603
}
605604

606605
@Test
@@ -611,8 +610,7 @@ public void testHashNullKey() {
611610
try {
612611
connection.hExists(key, null);
613612
fail("hExists should fail with null key");
614-
} catch (DataAccessException expected) {
615-
}
613+
} catch (DataAccessException expected) {}
616614
}
617615

618616
@Test
@@ -625,8 +623,7 @@ public void testHashNullValue() {
625623
try {
626624
connection.hSet(key, field, null);
627625
fail("hSet should fail with null value");
628-
} catch (DataAccessException expected) {
629-
}
626+
} catch (DataAccessException expected) {}
630627
}
631628

632629
@Test
@@ -663,8 +660,7 @@ public void testPubSubWithNamedChannels() throws Exception {
663660

664661
try {
665662
Thread.sleep(500);
666-
} catch (InterruptedException ignore) {
667-
}
663+
} catch (InterruptedException ignore) {}
668664

669665
// open a new connection
670666
RedisConnection connection2 = connectionFactory.getConnection();
@@ -707,8 +703,7 @@ public void testPubSubWithPatterns() throws Exception {
707703

708704
try {
709705
Thread.sleep(500);
710-
} catch (InterruptedException ignore) {
711-
}
706+
} catch (InterruptedException ignore) {}
712707

713708
// open a new connection
714709
RedisConnection connection2 = connectionFactory.getConnection();
@@ -2639,8 +2634,7 @@ void scanShouldReadEntireValueRange() {
26392634
void scanWithType() {
26402635

26412636
assumeThat(isPipelinedOrQueueingConnection(connection))
2642-
.describedAs("SCAN is only available in non-pipeline | non-queueing mode")
2643-
.isFalse();
2637+
.describedAs("SCAN is only available in non-pipeline | non-queueing mode").isFalse();
26442638

26452639
connection.set("key", "data");
26462640
connection.lPush("list", "foo");
@@ -3361,8 +3355,7 @@ void geoSearchShouldConsiderDistanceCorrectly() {
33613355
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
33623356

33633357
actual.add(
3364-
connection.geoSearch(key, GeoReference.fromMember(PALERMO),
3365-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3358+
connection.geoSearch(key, GeoReference.fromMember(PALERMO), GeoShape.byRadius(new Distance(200, KILOMETERS)),
33663359
newGeoSearchArgs().limit(2).includeDistance().includeCoordinates()));
33673360

33683361
List<Object> results = getResults();
@@ -3380,8 +3373,7 @@ void geoSearchStoreByMemberShouldStoreResult() {
33803373
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
33813374

33823375
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromMember(PALERMO),
3383-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3384-
newGeoSearchStoreArgs().limit(2).storeDistance()));
3376+
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
33853377
actual.add(connection.zScore("georesults", PALERMO.getName()));
33863378
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
33873379

@@ -3399,8 +3391,7 @@ void geoSearchStoreByPointShouldStoreResult() {
33993391
actual.add(connection.geoAdd(key, Arrays.asList(ARIGENTO, CATANIA, PALERMO)));
34003392

34013393
actual.add(connection.geoSearchStore("georesults", key, GeoReference.fromCoordinate(PALERMO),
3402-
GeoShape.byRadius(new Distance(200, KILOMETERS)),
3403-
newGeoSearchStoreArgs().limit(2).storeDistance()));
3394+
GeoShape.byRadius(new Distance(200, KILOMETERS)), newGeoSearchStoreArgs().limit(2).storeDistance()));
34043395
actual.add(connection.zScore("georesults", PALERMO.getName()));
34053396
actual.add(connection.zScore("georesults", ARIGENTO.getName()));
34063397

@@ -3577,22 +3568,21 @@ void bitFieldIncrByWithOverflowShouldWorkCorrectly() {
35773568
assertThat(results.get(3)).isNotNull();
35783569
}
35793570

3580-
@ParameterizedTest // DATAREDIS-2903
3581-
@ValueSource(booleans = {false, true})
3582-
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
3583-
var offset = isMultipliedByTypeLengthOffset
3584-
? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
3585-
: BitFieldSubCommands.Offset.offset(400L);
3571+
@ParameterizedTest // GH-2903
3572+
@ValueSource(booleans = { false, true })
3573+
void bitFieldIncrByAndThenGetShouldWorkCorrectly(boolean isMultipliedByTypeLengthOffset) {
35863574

3587-
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
3588-
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
3575+
var offset = isMultipliedByTypeLengthOffset ? BitFieldSubCommands.Offset.offset(300L).multipliedByTypeLength()
3576+
: BitFieldSubCommands.Offset.offset(400L);
35893577

3590-
List<Object> results = getResults();
3578+
actual.add(connection.bitfield(KEY_1, create().incr(INT_8).valueAt(offset).by(1L)));
3579+
actual.add(connection.bitfield(KEY_1, create().get(INT_8).valueAt(offset)));
35913580

3592-
assertThat(results).hasSize(2)
3593-
// should return same results after INCRBY and GET operations for bitfield with same offset
3594-
.containsExactly(List.of(1L), List.of(1L));
3595-
}
3581+
List<Object> results = getResults();
3582+
3583+
// should return same results after INCRBY and GET operations for bitfield with same offset
3584+
assertThat(results).containsExactly(List.of(1L), List.of(1L));
3585+
}
35963586

35973587
@Test // DATAREDIS-562
35983588
void bitfieldShouldAllowMultipleSubcommands() {
@@ -3881,8 +3871,8 @@ public void xPendingShouldLoadPendingMessagesForConsumer() {
38813871
actual.add(connection.xReadGroupAsString(Consumer.from("my-group", "my-consumer"),
38823872
StreamOffset.create(KEY_1, ReadOffset.lastConsumed())));
38833873

3884-
actual.add(connection.xPending(KEY_1, "my-group", "my-consumer",
3885-
org.springframework.data.domain.Range.unbounded(), 10L));
3874+
actual.add(
3875+
connection.xPending(KEY_1, "my-group", "my-consumer", org.springframework.data.domain.Range.unbounded(), 10L));
38863876

38873877
List<Object> results = getResults();
38883878
assertThat(results).hasSize(4);
@@ -4103,7 +4093,7 @@ public void xinfoConsumersNoConsumer() {
41034093
assertThat(info.size()).isZero();
41044094
}
41054095

4106-
@Test //GH-2345
4096+
@Test // GH-2345
41074097
public void zRangeStoreByScoreStoresKeys() {
41084098
String dstKey = KEY_2;
41094099
String srcKey = KEY_1;
@@ -4141,7 +4131,7 @@ public void zRangeStoreRevByScoreStoresKeys() {
41414131
assertThat((LinkedHashSet<Object>) result.get(5)).containsSequence(VALUE_3, VALUE_4);
41424132
}
41434133

4144-
@Test //GH-2345
4134+
@Test // GH-2345
41454135
public void zRangeStoreByLexStoresKeys() {
41464136
String dstKey = KEY_2;
41474137
String srcKey = KEY_1;

0 commit comments

Comments
 (0)