Should you use Mockito thenReturn or thenAnswer? It depends! The thenReturn returns the same value in every method run; while the thenAnswer does not. We use the former to return hard-coded values; while we use the latter for derived values.
Should you use Mockito thenReturn or thenAnswer? It depends! The thenReturn returns the same value in every method run; while the thenAnswer does not. We use the former to return hard-coded values; while we use the latter for derived values.