1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -38,30 +38,30 @@ public class ExponentialBackOffTests {
38
38
public void defaultInstance () {
39
39
ExponentialBackOff backOff = new ExponentialBackOff ();
40
40
BackOffExecution execution = backOff .start ();
41
- assertEquals (2000l , execution .nextBackOff ());
42
- assertEquals (3000l , execution .nextBackOff ());
43
- assertEquals (4500l , execution .nextBackOff ());
41
+ assertEquals (2000L , execution .nextBackOff ());
42
+ assertEquals (3000L , execution .nextBackOff ());
43
+ assertEquals (4500L , execution .nextBackOff ());
44
44
}
45
45
46
46
@ Test
47
47
public void simpleIncrease () {
48
48
ExponentialBackOff backOff = new ExponentialBackOff (100L , 2.0 );
49
49
BackOffExecution execution = backOff .start ();
50
- assertEquals (100l , execution .nextBackOff ());
51
- assertEquals (200l , execution .nextBackOff ());
52
- assertEquals (400l , execution .nextBackOff ());
53
- assertEquals (800l , execution .nextBackOff ());
50
+ assertEquals (100L , execution .nextBackOff ());
51
+ assertEquals (200L , execution .nextBackOff ());
52
+ assertEquals (400L , execution .nextBackOff ());
53
+ assertEquals (800L , execution .nextBackOff ());
54
54
}
55
55
56
56
@ Test
57
57
public void fixedIncrease () {
58
58
ExponentialBackOff backOff = new ExponentialBackOff (100L , 1.0 );
59
- backOff .setMaxElapsedTime (300l );
59
+ backOff .setMaxElapsedTime (300L );
60
60
61
61
BackOffExecution execution = backOff .start ();
62
- assertEquals (100l , execution .nextBackOff ());
63
- assertEquals (100l , execution .nextBackOff ());
64
- assertEquals (100l , execution .nextBackOff ());
62
+ assertEquals (100L , execution .nextBackOff ());
63
+ assertEquals (100L , execution .nextBackOff ());
64
+ assertEquals (100L , execution .nextBackOff ());
65
65
assertEquals (BackOffExecution .STOP , execution .nextBackOff ());
66
66
}
67
67
@@ -71,10 +71,10 @@ public void maxIntervalReached() {
71
71
backOff .setMaxInterval (4000L );
72
72
73
73
BackOffExecution execution = backOff .start ();
74
- assertEquals (2000l , execution .nextBackOff ());
75
- assertEquals (4000l , execution .nextBackOff ());
76
- assertEquals (4000l , execution .nextBackOff ()); // max reached
77
- assertEquals (4000l , execution .nextBackOff ());
74
+ assertEquals (2000L , execution .nextBackOff ());
75
+ assertEquals (4000L , execution .nextBackOff ());
76
+ assertEquals (4000L , execution .nextBackOff ()); // max reached
77
+ assertEquals (4000L , execution .nextBackOff ());
78
78
}
79
79
80
80
@ Test
@@ -83,8 +83,8 @@ public void maxAttemptsReached() {
83
83
backOff .setMaxElapsedTime (4000L );
84
84
85
85
BackOffExecution execution = backOff .start ();
86
- assertEquals (2000l , execution .nextBackOff ());
87
- assertEquals (4000l , execution .nextBackOff ());
86
+ assertEquals (2000L , execution .nextBackOff ());
87
+ assertEquals (4000L , execution .nextBackOff ());
88
88
assertEquals (BackOffExecution .STOP , execution .nextBackOff ()); // > 4 sec wait in total
89
89
}
90
90
@@ -98,10 +98,10 @@ public void startReturnDifferentInstances() {
98
98
BackOffExecution execution = backOff .start ();
99
99
BackOffExecution execution2 = backOff .start ();
100
100
101
- assertEquals (2000l , execution .nextBackOff ());
102
- assertEquals (2000l , execution2 .nextBackOff ());
103
- assertEquals (4000l , execution .nextBackOff ());
104
- assertEquals (4000l , execution2 .nextBackOff ());
101
+ assertEquals (2000L , execution .nextBackOff ());
102
+ assertEquals (2000L , execution2 .nextBackOff ());
103
+ assertEquals (4000L , execution .nextBackOff ());
104
+ assertEquals (4000L , execution2 .nextBackOff ());
105
105
assertEquals (BackOffExecution .STOP , execution .nextBackOff ());
106
106
assertEquals (BackOffExecution .STOP , execution2 .nextBackOff ());
107
107
}
0 commit comments