AbstractMutableLoanImpl() { this.id = RandomUtil.getNextInt(Integer.MAX_VALUE); // simplifies tests which do not need to set IDs themselves }
MutableInvestmentImpl() { this.id = RandomUtil.getNextInt(); // simplifies tests which do not have to generate random IDs themselves }
/** * How long to wait from when this method is called before first running the payload. * @return By default, this returns a random duration of less than 1000 seconds. */ default Duration startIn() { final long randomSeconds = RandomUtil.getNextInt(1000); return Duration.ofSeconds(randomSeconds); }
@Test void replacesWithSynthetic() { final int first = 123456; when(random.nextInt()).thenReturn(first); when(random.nextInt(anyInt())).thenAnswer(i -> i.getArgument(0)); SoftAssertions.assertSoftly(softly -> { softly.assertThat(RandomUtil.getNextInt()).isEqualTo(first); final int second = 234567; softly.assertThat(RandomUtil.getNextInt(second)).isEqualTo(second); }); } }