Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9057325
commit 894632c
Showing
7 changed files
with
173 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/java/net/jodah/failsafe/AbstractExecutionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.jodah.failsafe; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
@Test | ||
public class AbstractExecutionTest { | ||
public void testRandomizeDelayForFactor() { | ||
assertEquals(AbstractExecution.randomizeDelay(100, .5, 0), 150); | ||
assertEquals(AbstractExecution.randomizeDelay(100, .5, .25), 125); | ||
assertEquals(AbstractExecution.randomizeDelay(100, .5, .5), 100); | ||
assertEquals(AbstractExecution.randomizeDelay(100, .5, .75), 75); | ||
assertEquals(AbstractExecution.randomizeDelay(100, .5, .9999), 50); | ||
|
||
assertEquals(AbstractExecution.randomizeDelay(500, .5, .25), 625); | ||
assertEquals(AbstractExecution.randomizeDelay(500, .5, .75), 375); | ||
assertEquals(AbstractExecution.randomizeDelay(50000, .5, .25), 62500); | ||
} | ||
|
||
public void testRandomizeDelayForDuration() { | ||
assertEquals(AbstractExecution.randomizeDelay(100, 50, 0), 150); | ||
assertEquals(AbstractExecution.randomizeDelay(100, 50, .25), 125); | ||
assertEquals(AbstractExecution.randomizeDelay(100, 50, .5), 100); | ||
assertEquals(AbstractExecution.randomizeDelay(100, 50, .75), 75); | ||
assertEquals(AbstractExecution.randomizeDelay(100, 50, .9999), 50); | ||
|
||
assertEquals(AbstractExecution.randomizeDelay(500, 50, .25), 525); | ||
assertEquals(AbstractExecution.randomizeDelay(50000, 5000, .25), 52500); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters