I'm slightly confused concerning the mentioned blog post.
Here's the code example of the passage
// given
User user = new User("Zaphod", "zaphod@galaxy.net");
boolean sendWelcomeMail = true;
given(userRepository.save(any(UserEntity.class))).willReturn(userEntity(1L));
// when
Long userId = registerUseCase.registerUser(user, sendWelcomeMail);
// then
assertThat(userId).isEqualTo(1L);
We see given being used in the example.
The passage mentions when though:
Using Mockito’s when method, we have specified the expected behavior for this mock in order to test a class that uses this repository.
Is that a mixup or "unfortunate wording"?
Thanks again for the quality content 💯
I'm slightly confused concerning the mentioned blog post.
Here's the code example of the passage
We see
given
being used in the example. The passage mentionswhen
though:Is that a mixup or "unfortunate wording"? Thanks again for the quality content 💯