I took a working test written for JUnit using Mockito and tried to adapt it to work with TestNG but oddly using TestNG only one test will work.
I think it is somehow rel
There is a difference in the behaviour of these frameworks:
@Test
sFor Mockito you need to init mocks before every test method so that the state is not shared between two @Test
s in TestNG:
@BeforeMethod
public void init() {
MockitoAnnotations.initMocks(this);
}
For JUnit it works out of box because 2nd @Test
has its own fields and its own mocks.