On Thu, 10 Mar 2022 22:21:28 GMT, Stuart Marks <sma...@openjdk.org> wrote:

> The difficulty with having a loop instead of constants is that the expected 
> value now needs to be computed. We could probably use `tableSizeFor` to do 
> this. But this is starting to get uncomfortably close to a testing 
> antipattern which is to use the code under test as part of the test. If a bug 
> is introduced into `tableSizeFor`, it could introduce the error into both the 
> actual value and the expected value, covering up the bug. (This is related to 
> one of the flaws with the Enum/ConstantDirectoryOptimalCapacity test.) Now we 
> _hope_ that `tableSizeFor` is correct and tested, but that verges on having 
> tests depend on each other in a subtle and uncomfortable way.

you are correct about this.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431

Reply via email to