@@ -531,7 +531,7 @@ public void atualizarParcial_invalidCpfUpdating_returns409() throws Exception{
531531 .andExpect (content ().string ("Alteração de CPF não permitida." ));
532532 }
533533
534- @ ParameterizedTest @ NullAndEmptySource @ ValueSource (strings = " " ) @ Transactional
534+ @ ParameterizedTest @ NullAndEmptySource @ Transactional @ ValueSource (strings = " " )
535535 @ DisplayName ("It tries to update client's name with an empty string and a null value." )
536536 public void atualizarParcial_invalidName_returns400 (String nome ) throws Exception {
537537 Cliente cliente1 = new Cliente ();
@@ -547,6 +547,27 @@ public void atualizarParcial_invalidName_returns400(String nome) throws Exceptio
547547 .content (mapper .writeValueAsString (updates ))).andExpect (status ().isBadRequest ())
548548 .andExpect (content ().string ("Nome não pode ser vazio ou nulo." ));
549549 }
550+
551+ @ ParameterizedTest @ NullAndEmptySource @ Transactional
552+ @ ValueSource (strings = {" " , "marcus@marcus@marcus" , "marcus.com" , "@marcus.com" , "marcus@" })
553+ @ DisplayName ("It tries to update partial information of the client with an invalid e-mail address and"
554+ + "returns 400." )
555+ public void atualizarParcial_invalidEmailAdress_returns400 (String email ) throws Exception {
556+ Cliente cliente1 = new Cliente ();
557+ cliente1 .setNome ("Marcus" );
558+ cliente1 .setCpf ("23501206586" );
559+ cliente1 .setEmail ("marcus@gmail.com" );
560+ repository .saveAndFlush (cliente1 );
561+
562+ Map <String , Object > updates = new HashMap <>();
563+ updates .put ("email" , email );
564+
565+ mvc .perform (patch ("/parcial/" +cliente1 .getId ()).contentType (MediaType .APPLICATION_JSON )
566+ .content (mapper .writeValueAsString (updates ))).andExpect (status ().isBadRequest ())
567+ .andExpect (content ().string (containsString ("inválido" )));
568+ }
569+
570+
550571
551572}
552573
0 commit comments