We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8877f30 commit 43e82f7Copy full SHA for 43e82f7
1 file changed
spring-boot/spring-boot-testing/src/test/java/io/reflectoring/testing/MockBeanTest.java
@@ -16,6 +16,7 @@
16
import org.springframework.test.context.TestPropertySource;
17
import static org.assertj.core.api.Assertions.*;
18
import static org.mockito.ArgumentMatchers.any;
19
+import static org.mockito.BDDMockito.*;
20
import static org.mockito.Mockito.when;
21
22
@SpringBootTest
@@ -32,9 +33,9 @@ void testRegister(){
32
33
// given
34
User user = new User("Zaphod", "[email protected]");
35
boolean sendWelcomeMail = true;
36
+ given(userRepository.save(any(UserEntity.class))).willReturn(userEntity(1L));
37
38
// when
- when(userRepository.save(any(UserEntity.class))).thenReturn(userEntity(1L));
39
Long userId = registerUseCase.registerUser(user, sendWelcomeMail);
40
41
// then
0 commit comments