I have a class A with 2 functions: a () function that returns a random number. function b (), which calls a () and returns the return value.
In the test, I wrote this:
A test = Mockito.mock(A.class) Mockito.when(test.a()).thenReturn(35) assertEquals(35,test.a()) assertEquals(35,test.b())
The test fails in the second statement. Does anyone know why?
To be clear, this is not my real code, but simple code to explain my problem.
java unit-testing mockito mocking
tamird14
source share