1010import com .datastax .oss .driver .api .core .session .ProgrammaticArguments ;
1111import com .datastax .oss .driver .internal .core .config .typesafe .DefaultProgrammaticDriverConfigLoaderBuilder ;
1212import com .datastax .oss .driver .internal .core .context .DefaultDriverContext ;
13- import org .junit .Assert ;
14- import org .junit .Test ;
13+ import org .junit .jupiter . api . Test ;
14+ import static org .junit .jupiter . api . Assertions .* ;
1515import com .datastax .oss .driver .shaded .guava .common .base .Stopwatch ;
1616
1717import java .time .Duration ;
@@ -24,7 +24,7 @@ public void determineRetryDecisionExceed() {
2424 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
2525 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 , Duration .ofMillis (10 ), Duration .ofMillis (50 ));
2626
27- Assert . assertEquals (RetryDecision .RETHROW , st .determineRetryDecision (4 ));
27+ assertEquals (RetryDecision .RETHROW , st .determineRetryDecision (4 ));
2828
2929 }
3030 @ Test
@@ -42,7 +42,7 @@ public void determineRetryTimeToMinWhenRetry() {
4242
4343 long millsObserved = stopwatch .elapsed ().toMillis ();
4444
45- Assert . assertTrue (millsObserved > 1 && millsObserved < 21 );
45+ assertTrue (millsObserved > 1 && millsObserved < 21 );
4646
4747 }
4848 @ Test
@@ -62,7 +62,7 @@ public void determineRetryTimeToMinWhenNotRetry() {
6262
6363 System .out .println (millsObserved );
6464
65- Assert . assertTrue (millsObserved >= 0 && millsObserved < 5 );
65+ assertTrue (millsObserved >= 0 && millsObserved < 5 );
6666
6767 }
6868 @ Test
@@ -81,7 +81,7 @@ public void determineRetryTimeToMinWait() {
8181 long millsObserved = stopwatch .elapsed ().toMillis ();
8282
8383
84- Assert . assertTrue (String . format ( "Asset %s" , millsObserved ), millsObserved > 1 && millsObserved < 20 );
84+ assertTrue (millsObserved > 1 && millsObserved < 20 , String . format ( "Asset %s" , millsObserved ) );
8585
8686 }
8787 @ Test
@@ -99,7 +99,7 @@ public void determineRetryTimeToWaitMax() {
9999
100100 long millsObserved = stopwatch .elapsed ().toMillis ();
101101
102- Assert . assertTrue (String . format ( " millsObserved: %d" , millsObserved ), millsObserved > 10 && millsObserved < 100 );
102+ assertTrue (millsObserved > 10 && millsObserved < 100 , String . format ( "millsObserved: %d" , millsObserved ) );
103103
104104 }
105105
@@ -108,7 +108,7 @@ public void determineRetryDecisionMin() {
108108 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
109109 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
110110
111- Assert . assertEquals (RetryDecision .RETRY_SAME , st .determineRetryDecision (0 ));
111+ assertEquals (RetryDecision .RETRY_SAME , st .determineRetryDecision (0 ));
112112
113113 }
114114
@@ -117,7 +117,7 @@ public void determineRetryDecisionMid() {
117117 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
118118 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
119119
120- Assert . assertEquals (RetryDecision .RETRY_SAME , st .determineRetryDecision (1 ));
120+ assertEquals (RetryDecision .RETRY_SAME , st .determineRetryDecision (1 ));
121121
122122 }
123123
@@ -126,7 +126,7 @@ public void onWriteTimeout() {
126126 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
127127 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
128128
129- Assert . assertEquals (RetryDecision .RETRY_SAME , st .onWriteTimeout (null , ConsistencyLevel .LOCAL_QUORUM , WriteType .SIMPLE , 2 , 0 , 1 ));
129+ assertEquals (RetryDecision .RETRY_SAME , st .onWriteTimeout (null , ConsistencyLevel .LOCAL_QUORUM , WriteType .SIMPLE , 2 , 0 , 1 ));
130130
131131 }
132132
@@ -135,7 +135,7 @@ public void onWriteTimeoutExceed() {
135135 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
136136 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
137137
138- Assert . assertEquals (RetryDecision .RETHROW , st .onWriteTimeout (null , ConsistencyLevel .LOCAL_QUORUM , WriteType .SIMPLE , 2 , 0 , 4 ));
138+ assertEquals (RetryDecision .RETHROW , st .onWriteTimeout (null , ConsistencyLevel .LOCAL_QUORUM , WriteType .SIMPLE , 2 , 0 , 4 ));
139139
140140 }
141141
@@ -144,7 +144,7 @@ public void onReadTimeout() {
144144 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
145145 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
146146
147- Assert . assertEquals (RetryDecision .RETRY_SAME , st .onReadTimeout (null , ConsistencyLevel .LOCAL_QUORUM , 2 , 0 , false , 1 ));
147+ assertEquals (RetryDecision .RETRY_SAME , st .onReadTimeout (null , ConsistencyLevel .LOCAL_QUORUM , 2 , 0 , false , 1 ));
148148
149149 }
150150
@@ -153,7 +153,7 @@ public void onReadTimeoutExceed() {
153153 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
154154 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
155155
156- Assert . assertEquals (RetryDecision .RETHROW , st .onReadTimeout (null , ConsistencyLevel .LOCAL_QUORUM , 2 , 0 , false , 4 ));
156+ assertEquals (RetryDecision .RETHROW , st .onReadTimeout (null , ConsistencyLevel .LOCAL_QUORUM , 2 , 0 , false , 4 ));
157157
158158 }
159159
@@ -162,7 +162,7 @@ public void oneError() {
162162 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
163163 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
164164
165- Assert . assertEquals (RetryDecision .RETRY_SAME , st .onErrorResponse (null , new WriteFailureException (null , ConsistencyLevel .LOCAL_QUORUM , 0 , 2 , WriteType .SIMPLE , 1 , null ), 2 ));
165+ assertEquals (RetryDecision .RETRY_SAME , st .onErrorResponse (null , new WriteFailureException (null , ConsistencyLevel .LOCAL_QUORUM , 0 , 2 , WriteType .SIMPLE , 1 , null ), 2 ));
166166
167167 }
168168
@@ -172,7 +172,7 @@ public void oneErrorExceed() {
172172 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
173173
174174
175- Assert . assertEquals (RetryDecision .RETHROW , st .onErrorResponse (null , new WriteFailureException (null , ConsistencyLevel .LOCAL_QUORUM , 0 , 2 , WriteType .SIMPLE , 1 , null ), 4 ));
175+ assertEquals (RetryDecision .RETHROW , st .onErrorResponse (null , new WriteFailureException (null , ConsistencyLevel .LOCAL_QUORUM , 0 , 2 , WriteType .SIMPLE , 1 , null ), 4 ));
176176
177177 }
178178
@@ -181,7 +181,7 @@ public void onUnavailable() {
181181 DriverContext context = new DefaultDriverContext (new DefaultProgrammaticDriverConfigLoaderBuilder ().build (), ProgrammaticArguments .builder ().build ());
182182 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
183183
184- Assert . assertEquals (RetryDecision .RETRY_SAME , st .onUnavailable (null , ConsistencyLevel .LOCAL_QUORUM , 1 , 1 , 2 ));
184+ assertEquals (RetryDecision .RETRY_SAME , st .onUnavailable (null , ConsistencyLevel .LOCAL_QUORUM , 1 , 1 , 2 ));
185185
186186 }
187187
@@ -191,14 +191,14 @@ public void onUnavailableExceed() {
191191 AmazonKeyspacesExponentialRetryPolicy st = new AmazonKeyspacesExponentialRetryPolicy (context , 3 );
192192
193193
194- Assert . assertEquals (RetryDecision .RETHROW , st .onUnavailable (null , ConsistencyLevel .LOCAL_QUORUM , 1 , 1 , 4 ));
194+ assertEquals (RetryDecision .RETHROW , st .onUnavailable (null , ConsistencyLevel .LOCAL_QUORUM , 1 , 1 , 4 ));
195195 }
196196
197197 @ Test
198198 public void testConfig () {
199- Assert . assertEquals (3 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getInt (KeyspacesRetryOption .KEYSPACES_RETRY_MAX_ATTEMPTS , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MAX_ATTEMPTS ));
200- Assert . assertEquals (5 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getDuration (KeyspacesRetryOption .KEYSPACES_RETRY_MIN_WAIT , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MIN_WAIT ).toMillis ());
201- Assert . assertEquals (100 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getDuration (KeyspacesRetryOption .KEYSPACES_RETRY_MAX_WAIT , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MAX_WAIT ).toMillis ());
199+ assertEquals (3 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getInt (KeyspacesRetryOption .KEYSPACES_RETRY_MAX_ATTEMPTS , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MAX_ATTEMPTS ));
200+ assertEquals (10 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getDuration (KeyspacesRetryOption .KEYSPACES_RETRY_MIN_WAIT , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MIN_WAIT ).toMillis ());
201+ assertEquals (100 , DriverConfigLoader .fromClasspath ("exponential-retry-example" ).getInitialConfig ().getDefaultProfile ().getDuration (KeyspacesRetryOption .KEYSPACES_RETRY_MAX_WAIT , KeyspacesRetryOption .DEFAULT_KEYSPACES_RETRY_MAX_WAIT ).toMillis ());
202202 }
203203
204204}
0 commit comments