I'm new to the Mockito library and I can't understand the following syntax: before the test I defined -
when(CLASS.FUNCTION(PARAMETERS)).thenReturn(RETURN_VALUE)
And the actual test is -
assertSame(RETURN_VALUE, CLASS.FUNCTION(PARAMETERS))
Don't I just set the return value of the function with the first line of code (when... thenReturn) to be RETURN_VALUE? If the answer is yes, then of course assertSame will be true and the test will pass, what am I missing here?