99import org .junit .jupiter .api .Timeout ;
1010
1111class FlagdProviderSyncResourcesTest {
12- private static final long PERMISSIBLE_EPSILON = 20 ;
12+ private static final long MAX_TIME_TOLERANCE = 20 ;
1313
1414 private FlagdProviderSyncResources flagdProviderSyncResources ;
1515
@@ -39,7 +39,7 @@ void waitForInitialization_waitsApproxForDeadline() {
3939 // should wait at least for the deadline
4040 Assertions .assertTrue (elapsed >= deadline );
4141 // should not wait much longer than the deadline
42- Assertions .assertTrue (elapsed < deadline + PERMISSIBLE_EPSILON );
42+ Assertions .assertTrue (elapsed < deadline + MAX_TIME_TOLERANCE );
4343 }
4444
4545 @ Timeout (2 )
@@ -57,15 +57,15 @@ void interruptingWaitingThread_isIgnored() throws InterruptedException {
5757 long duration = end - start ;
5858 // even though thread was interrupted, it still waited for the deadline
5959 Assertions .assertTrue (duration >= deadline );
60- Assertions .assertTrue (duration < deadline + PERMISSIBLE_EPSILON );
60+ Assertions .assertTrue (duration < deadline + MAX_TIME_TOLERANCE );
6161 });
6262 waitingThread .start ();
6363
6464 while (!isWaiting .get ()) {
6565 Thread .yield ();
6666 }
6767
68- Thread .sleep (PERMISSIBLE_EPSILON ); // waitingThread should have started waiting in the meantime
68+ Thread .sleep (MAX_TIME_TOLERANCE ); // waitingThread should have started waiting in the meantime
6969
7070 for (int i = 0 ; i < 50 ; i ++) {
7171 waitingThread .interrupt ();
@@ -85,15 +85,15 @@ void callingInitialize_wakesUpWaitingThread() throws InterruptedException {
8585 flagdProviderSyncResources .waitForInitialization (10000 );
8686 long end = System .currentTimeMillis ();
8787 long duration = end - start ;
88- Assertions .assertTrue (duration < PERMISSIBLE_EPSILON );
88+ Assertions .assertTrue (duration < MAX_TIME_TOLERANCE );
8989 });
9090 waitingThread .start ();
9191
9292 while (!isWaiting .get ()) {
9393 Thread .yield ();
9494 }
9595
96- Thread .sleep (PERMISSIBLE_EPSILON ); // waitingThread should have started waiting in the meantime
96+ Thread .sleep (MAX_TIME_TOLERANCE ); // waitingThread should have started waiting in the meantime
9797
9898 flagdProviderSyncResources .initialize ();
9999
@@ -112,15 +112,15 @@ void callingShutdown_wakesUpWaitingThreadWithException() throws InterruptedExcep
112112
113113 long end = System .currentTimeMillis ();
114114 long duration = end - start ;
115- Assertions .assertTrue (duration < PERMISSIBLE_EPSILON );
115+ Assertions .assertTrue (duration < MAX_TIME_TOLERANCE );
116116 });
117117 waitingThread .start ();
118118
119119 while (!isWaiting .get ()) {
120120 Thread .yield ();
121121 }
122122
123- Thread .sleep (PERMISSIBLE_EPSILON ); // waitingThread should have started waiting in the meantime
123+ Thread .sleep (MAX_TIME_TOLERANCE ); // waitingThread should have started waiting in the meantime
124124
125125 flagdProviderSyncResources .shutdown ();
126126
@@ -134,7 +134,7 @@ void waitForInitializationAfterCallingInitialize_returnsInstantly() {
134134 long start = System .currentTimeMillis ();
135135 flagdProviderSyncResources .waitForInitialization (10000 );
136136 long end = System .currentTimeMillis ();
137- // do not use PERMISSIBLE_EPSILON here, this should happen faster than that
137+ // do not use MAX_TIME_TOLERANCE here, this should happen faster than that
138138 Assertions .assertTrue (start + 1 >= end );
139139 }
140140}
0 commit comments