Does Junit reinitialize the class with each test method invocation?

前端 未结 5 1938
执笔经年
执笔经年 2020-12-10 11:05

When i run the below code, both test cases come true:

import static junit.framework.Assert.assertEquals;

import org.junit.Test;

public class MyTest{
    pr         


        
5条回答
  •  囚心锁ツ
    2020-12-10 11:47

    If you want to use test class's member variable for all tests , without it being reinitialised to null, then make it static.

提交回复
热议问题