@@ -275,14 +275,11 @@ void testEchoStrategyDefaultSupplier() {
275
275
void testNewFieldLocations () {
276
276
// Test new field locations in ClusterConfig and MultiClusterClientConfig
277
277
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
278
- .builder (testEndpoint , testConfig )
279
- .weight (2.5f )
280
- .build ();
278
+ .builder (testEndpoint , testConfig ).weight (2.5f ).build ();
281
279
282
- MultiClusterClientConfig multiConfig = new MultiClusterClientConfig .Builder (new MultiClusterClientConfig .ClusterConfig []{clusterConfig })
283
- .retryOnFailover (true )
284
- .failbackSupported (false )
285
- .build ();
280
+ MultiClusterClientConfig multiConfig = new MultiClusterClientConfig .Builder (
281
+ new MultiClusterClientConfig .ClusterConfig [] { clusterConfig }).retryOnFailover (true )
282
+ .failbackSupported (false ).build ();
286
283
287
284
assertEquals (2.5f , clusterConfig .getWeight ());
288
285
assertTrue (multiConfig .isRetryOnFailover ());
@@ -293,15 +290,15 @@ void testNewFieldLocations() {
293
290
void testDefaultValues () {
294
291
// Test default values in ClusterConfig
295
292
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
296
- .builder (testEndpoint , testConfig )
297
- .build ();
293
+ .builder (testEndpoint , testConfig ).build ();
298
294
299
295
assertEquals (1.0f , clusterConfig .getWeight ()); // Default weight
300
- assertEquals (EchoStrategy .DEFAULT , clusterConfig .getHealthCheckStrategySupplier ()); // Default is null (no health check)
296
+ assertEquals (EchoStrategy .DEFAULT , clusterConfig .getHealthCheckStrategySupplier ()); // Default is null (no
297
+ // health check)
301
298
302
299
// Test default values in MultiClusterClientConfig
303
- MultiClusterClientConfig multiConfig = new MultiClusterClientConfig .Builder (new MultiClusterClientConfig . ClusterConfig []{ clusterConfig })
304
- .build ();
300
+ MultiClusterClientConfig multiConfig = new MultiClusterClientConfig .Builder (
301
+ new MultiClusterClientConfig . ClusterConfig [] { clusterConfig }) .build ();
305
302
306
303
assertFalse (multiConfig .isRetryOnFailover ()); // Default is false
307
304
assertTrue (multiConfig .isFailbackSupported ()); // Default is true
@@ -314,9 +311,7 @@ void testClusterConfigWithHealthCheckStrategy() {
314
311
MultiClusterClientConfig .StrategySupplier supplier = (hostAndPort , jedisClientConfig ) -> customStrategy ;
315
312
316
313
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
317
- .builder (testEndpoint , testConfig )
318
- .healthCheckStrategySupplier (supplier )
319
- .build ();
314
+ .builder (testEndpoint , testConfig ).healthCheckStrategySupplier (supplier ).build ();
320
315
321
316
assertNotNull (clusterConfig .getHealthCheckStrategySupplier ());
322
317
HealthCheckStrategy result = clusterConfig .getHealthCheckStrategySupplier ().get (testEndpoint , testConfig );
@@ -330,9 +325,7 @@ void testClusterConfigWithStrategySupplier() {
330
325
};
331
326
332
327
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
333
- .builder (testEndpoint , testConfig )
334
- .healthCheckStrategySupplier (customSupplier )
335
- .build ();
328
+ .builder (testEndpoint , testConfig ).healthCheckStrategySupplier (customSupplier ).build ();
336
329
337
330
assertEquals (customSupplier , clusterConfig .getHealthCheckStrategySupplier ());
338
331
}
@@ -344,9 +337,7 @@ void testClusterConfigWithEchoStrategy() {
344
337
};
345
338
346
339
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
347
- .builder (testEndpoint , testConfig )
348
- .healthCheckStrategySupplier (echoSupplier )
349
- .build ();
340
+ .builder (testEndpoint , testConfig ).healthCheckStrategySupplier (echoSupplier ).build ();
350
341
351
342
MultiClusterClientConfig .StrategySupplier supplier = clusterConfig .getHealthCheckStrategySupplier ();
352
343
assertNotNull (supplier );
@@ -356,8 +347,7 @@ void testClusterConfigWithEchoStrategy() {
356
347
@ Test
357
348
void testClusterConfigWithDefaultHealthCheck () {
358
349
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
359
- .builder (testEndpoint , testConfig )
360
- .build (); // Should use default EchoStrategy
350
+ .builder (testEndpoint , testConfig ).build (); // Should use default EchoStrategy
361
351
362
352
assertNotNull (clusterConfig .getHealthCheckStrategySupplier ());
363
353
assertEquals (EchoStrategy .DEFAULT , clusterConfig .getHealthCheckStrategySupplier ());
@@ -366,19 +356,15 @@ void testClusterConfigWithDefaultHealthCheck() {
366
356
@ Test
367
357
void testClusterConfigWithDisabledHealthCheck () {
368
358
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
369
- .builder (testEndpoint , testConfig )
370
- .healthCheckEnabled (false )
371
- .build ();
359
+ .builder (testEndpoint , testConfig ).healthCheckEnabled (false ).build ();
372
360
373
361
assertNull (clusterConfig .getHealthCheckStrategySupplier ());
374
362
}
375
363
376
364
@ Test
377
365
void testClusterConfigHealthCheckEnabledExplicitly () {
378
366
MultiClusterClientConfig .ClusterConfig clusterConfig = MultiClusterClientConfig .ClusterConfig
379
- .builder (testEndpoint , testConfig )
380
- .healthCheckEnabled (true )
381
- .build ();
367
+ .builder (testEndpoint , testConfig ).healthCheckEnabled (true ).build ();
382
368
383
369
assertNotNull (clusterConfig .getHealthCheckStrategySupplier ());
384
370
assertEquals (EchoStrategy .DEFAULT , clusterConfig .getHealthCheckStrategySupplier ());
@@ -391,6 +377,7 @@ void testHealthCheckRecoversAfterException() throws InterruptedException {
391
377
// Create a mock strategy that alternates between healthy and throwing an exception
392
378
HealthCheckStrategy alternatingStrategy = new HealthCheckStrategy () {
393
379
volatile boolean isHealthy = true ;
380
+
394
381
@ Override
395
382
public int getInterval () {
396
383
return 1 ;
0 commit comments