Skip to content

Commit

Permalink
refs #1 - Correção dos testes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan-pb committed Feb 11, 2021
1 parent 7e2ace1 commit 21dc6b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -35,10 +26,7 @@ final void saveUserTest() {
assertEquals(user.getFullName(), "ruan cruz soares");
assertEquals(user.isAdmin(), false);






}

@Test
Expand Down
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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 21dc6b1

Please sign in to comment.