On Mon, 16 Sep 2024 15:32:15 GMT, Jay Bhaskar <jbhas...@openjdk.org> wrote:

>> @Maran23 is right.  In the absence of support for parameterized class-level 
>> tests the easiest solution (I think) is to parameterize every `@Test`, which 
>> means:
>> - add parameters to each method, replace `@Test` with `@ParameterizedTest` 
>> and `@MethodSource`
>> - add parameters to setup method (`@Before`, remove the annotation)
>> - call the setup method from each test method
>> - remove the fields that were set in the constructor and the constructor 
>> itself
>> 
>> Things might be a bit more complicated in the case of test class 
>> hierarchies, so additional work and checks will be needed.
>
> still some tests fail, after applying  solution as suggested.

When hashValue and expected are instance variables, they are initialized once 
per test case due to how JUnit creates a new instance of the test class for 
each @ParameterizedTest. This ensures that the state is clean between tests and 
no variable is shared between different test cases. So I think it is ok.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1567#discussion_r1761413603

Reply via email to