File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/test/java/com/sistemaclliente Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,14 @@ public void encontrarClientePorCpf_success_returns200() throws Exception{
266266 .andExpect (jsonPath ("$.nome" ).value ("Marcus" )).andExpect (jsonPath ("$.cpf" ).value ("23501206586" ))
267267 .andExpect (jsonPath ("$.email" ).value ("marcus@gmail.com" ));
268268 }
269+
270+ @ Test @ Transactional @ DisplayName ("Tries to find client by CPF but fails. Returns 404" )
271+ public void encontrarClientePorCpf_clientNotFound_returns404 () throws Exception {
272+ mvc .perform (get ("/clientecpf/23501206586" )).andExpect (status ().isNotFound ())
273+ .andExpect (content ().string ("Cliente com o CPF = 23501206586 não encontrado." ));
274+
275+ assertThat (repository .findByCpf ("23501206586" )).isNotPresent ();
276+ }
269277}
270278
271279
Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ public void encontrarClientePorCpf_sucesso_retorno200() throws Exception{
403403 verifyNoMoreInteractions (service );
404404 }
405405
406- @ Test
406+ @ Test @ DisplayName ( "Tries to find client by CPF but fails. Returns 404" )
407407 public void encontrarClientePorCpf_clienteNotFound_retorno404 () throws Exception {
408408 when (service .encontrarPorCpf ("23501206586" ))
409409 .thenThrow (new ClienteNotFoundException ("23501206586" ));
You can’t perform that action at this time.
0 commit comments