I very much understand what @BeforeClass
is. It is executed once before JUnit test run is started & @Before
method is executed before every test case.
My question is regarding a very old post by a very senior stackoverflow user (Péter Török
68.8k) Please refer [stackoverflow question]
[1]: JUnit: using constructor instead of @Before which was posted about 2 yrs ago but on JUnit4. so I think it is still valid and true.
Here he mentions
@Before is equivalent to constructor of test class
and
JUnit creates a new instance of the test class for each @Test,
So how does JUnit manage running @BeforeClass
only once which is defined inside the test class?