Closed
Description
Despite of its purpose (and its name), the method runsFuncMultipleTimes
in RepeatedFuncTest
does not test if the function runs multiple times. Instead, it is testing if it is giving a different output in each call (in other words, if it is giving a random number each time).
Another way to look at the bug is that modifying the test such as not using RepeatedFunc
at all, will succeed anyway.
@Test
public void runsFuncMultipleTimes() throws Exception {
final Func<Boolean, Integer> func = (
input -> {
return new SecureRandom().nextInt();
}
);
MatcherAssert.assertThat(
func.apply(true),
Matchers.not(Matchers.equalTo(func.apply(true)))
);
}
I expect the test to check if the "origin" function was actually executed as many times as wanted.
Metadata
Assignees
Labels
No labels