Junit class variable class

I have a Junit test class with two tests. test 1 will add an element to an ArrayList and pass it to the main class to do some logic and return true. Test two should use the same List array and call the same main class that executes the same logic, but by the time the list goes to the second test method and it gets null.

I declared it a class variable. My questions are: when I assign values ​​to a class variable in a test method, will I not have access to the values ​​in the next test method? If so, how do I save the values.

Thanks Mahi

+5
source share
1 answer

jUnit, . , x Test1, , Test2. - , .

+7

All Articles