Compare commits
2 Commits
4ab23b99c8
...
9eec90ef98
Author | SHA1 | Date | |
---|---|---|---|
9eec90ef98 | |||
bd06fc047d |
@ -15,6 +15,8 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@SpringBootTest
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class UserServiceTest {
|
||||
@ -50,7 +52,13 @@ public class UserServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRegisterNewUser () throws Exception{
|
||||
void testRegisterNewUser_normal () throws Exception{
|
||||
|
||||
when(userRepository.existsByEmail(registrationDto.getEmail())).thenReturn(false);
|
||||
|
||||
when(passwordEncoder.encode(registrationDto.getPassword())).thenReturn(registrationDto.getPassword());
|
||||
|
||||
when(userRepository.save(userEntity)).thenAnswer(invocation -> invocation.getArgument(0));
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user