15
15
*/
16
16
package io .lettuce .core .cluster ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
18
+ import static org .assertj .core .api .Assertions .* ;
19
19
20
20
import java .time .Duration ;
21
21
import java .util .concurrent .TimeUnit ;
25
25
import io .lettuce .core .cluster .ClusterTopologyRefreshOptions .RefreshTrigger ;
26
26
27
27
/**
28
+ * Unit tests for {@link ClusterTopologyRefreshOptions}.
29
+ *
28
30
* @author Mark Paluch
29
31
*/
30
32
class ClusterTopologyRefreshOptionsUnitTests {
@@ -80,16 +82,16 @@ void testDefault() {
80
82
81
83
assertThat (options .getRefreshPeriod ()).isEqualTo (ClusterTopologyRefreshOptions .DEFAULT_REFRESH_PERIOD_DURATION );
82
84
assertThat (options .isCloseStaleConnections ()).isEqualTo (ClusterTopologyRefreshOptions .DEFAULT_CLOSE_STALE_CONNECTIONS );
83
- assertThat (options .isPeriodicRefreshEnabled ())
84
- .isEqualTo ( ClusterTopologyRefreshOptions . DEFAULT_PERIODIC_REFRESH_ENABLED ). isFalse ();
85
+ assertThat (options .isPeriodicRefreshEnabled ()). isEqualTo ( ClusterTopologyRefreshOptions . DEFAULT_PERIODIC_REFRESH_ENABLED )
86
+ .isFalse ();
85
87
assertThat (options .useDynamicRefreshSources ()).isEqualTo (ClusterTopologyRefreshOptions .DEFAULT_DYNAMIC_REFRESH_SOURCES )
86
88
.isTrue ();
87
- assertThat (options .getAdaptiveRefreshTimeout ()). isEqualTo (
88
- ClusterTopologyRefreshOptions .DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_DURATION );
89
- assertThat (options .getAdaptiveRefreshTriggers ()). isEqualTo (
90
- ClusterTopologyRefreshOptions .DEFAULT_ADAPTIVE_REFRESH_TRIGGERS );
91
- assertThat (options .getRefreshTriggersReconnectAttempts ()). isEqualTo (
92
- ClusterTopologyRefreshOptions .DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS );
89
+ assertThat (options .getAdaptiveRefreshTimeout ())
90
+ . isEqualTo ( ClusterTopologyRefreshOptions .DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_DURATION );
91
+ assertThat (options .getAdaptiveRefreshTriggers ())
92
+ . isEqualTo ( ClusterTopologyRefreshOptions .DEFAULT_ADAPTIVE_REFRESH_TRIGGERS );
93
+ assertThat (options .getRefreshTriggersReconnectAttempts ())
94
+ . isEqualTo ( ClusterTopologyRefreshOptions .DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS );
93
95
}
94
96
95
97
@ Test
@@ -102,4 +104,13 @@ void testEnabled() {
102
104
assertThat (options .getAdaptiveRefreshTriggers ()).contains (RefreshTrigger .ASK_REDIRECT , RefreshTrigger .MOVED_REDIRECT ,
103
105
RefreshTrigger .PERSISTENT_RECONNECTS );
104
106
}
107
+
108
+ @ Test
109
+ void emptyTriggersShouldFail () {
110
+
111
+ ClusterTopologyRefreshOptions .Builder builder = ClusterTopologyRefreshOptions .builder ();
112
+
113
+ assertThatIllegalArgumentException ().isThrownBy (builder ::enableAdaptiveRefreshTrigger );
114
+ }
115
+
105
116
}
0 commit comments