-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,22 +11,13 @@ | |
|
||
public class RegisterUserImplTest { | ||
|
||
|
||
|
||
|
||
private UserRepository repositorio = mock(UserRepository.class); | ||
|
||
private RegisterUserImpl registro = new RegisterUserImpl(repositorio); | ||
|
||
|
||
|
||
private RegisterUserImpl registro = new RegisterUserImpl(repositorio); | ||
|
||
@Test | ||
final void saveUserTest() { | ||
|
||
RegisterUserDTO user = new RegisterUserDTO("ruancruz", "ruansenha", "[email protected]", "ruan cruz soares", "imagee", false, "professor"); | ||
|
||
|
||
registro.save(user); | ||
System.out.println(user); | ||
|
||
|
@@ -35,10 +26,7 @@ final void saveUserTest() { | |
assertEquals(user.getFullName(), "ruan cruz soares"); | ||
assertEquals(user.isAdmin(), false); | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package org.ayty.hatcher.api.v1.user.service; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
@@ -28,21 +29,11 @@ class RemoveUserImplTest { | |
@Test | ||
void DeleteUsertest() { | ||
|
||
|
||
when(repositorio.findById(1L)).thenReturn(Optional.empty()); | ||
|
||
User usuario = new User(1L,"ruan", "ruan", "[email protected]", "ruan", "imagee 1", true, Profile.PROFESSOR); | ||
when(repositorio.findById(1L)).thenReturn(Optional.of(usuario)); | ||
|
||
assertDoesNotThrow(() -> RemoveUser.removeUser(1L)); | ||
|
||
|
||
|
||
repositorio.save(usuario); | ||
repositorio.delete(usuario); | ||
|
||
|
||
assertTrue(repositorio.findById(1L).isEmpty()); | ||
|
||
|
||
} | ||
|
||
@Test | ||
|