@@ -466,6 +466,7 @@ void addTaskOwner_asAdmin_toOrgUser_shouldSucceed() {
466466 .anyMatch (owner -> owner .getId ().getOwnerId ().equals (200L )));
467467
468468 verify (taskBodyMapper ).toResponse (taskBody , testFiles , "creator@mail.com" );
469+ verify (taskBodyRepository ).saveAndFlush (taskBody );
469470 }
470471
471472 @ Test
@@ -579,6 +580,7 @@ void removeTaskOwner_shouldSucceed() {
579580 .anyMatch (o -> o .getId ().getOwnerId ().equals (200L )));
580581
581582 verify (taskBodyMapper ).toResponse (taskBody , testFiles , "creator@mail.com" );
583+ verify (taskBodyRepository ).saveAndFlush (taskBody );
582584 }
583585
584586 @ Test
@@ -717,7 +719,10 @@ void updateTask_staleVersion_shouldThrowStaleTaskVersionException() {
717719
718720 assertThrows (StaleTaskVersionException .class , () -> taskService .updateTask (1L , request ));
719721
720- verify (taskBodyRepository , never ()).save (any ());
722+ verify (taskBodyRepository , never ()).saveAndFlush (any ());
723+
724+ assertEquals ("Test Task" , taskBody .getTitle ());
725+ assertEquals ("Test Description" , taskBody .getDescription ());
721726 }
722727
723728 @ Test
@@ -731,6 +736,11 @@ void addTaskOwner_staleVersion_shouldThrowStaleTaskVersionException() {
731736 when (userFacade .findByEmail ("newowner@mail.com" )).thenReturn (Optional .of (newOwner ));
732737
733738 assertThrows (StaleTaskVersionException .class , () -> taskService .addTaskOwner (1L , request ));
739+
740+ verify (taskBodyRepository , never ()).saveAndFlush (any ());
741+
742+ assertEquals (1 , taskBody .getOwners ().size ());
743+ assertFalse (taskBody .getOwners ().stream ().anyMatch (o -> o .getId ().getOwnerId ().equals (200L )));
734744 }
735745
736746 @ Test
@@ -745,6 +755,9 @@ void removeTaskOwner_staleVersion_shouldThrowStaleTaskVersionException() {
745755
746756 assertThrows (StaleTaskVersionException .class , () -> taskService .removeTaskOwner (1L , request ));
747757
758+ verify (taskBodyRepository , never ()).saveAndFlush (any ());
759+
748760 assertEquals (1 , taskBody .getOwners ().size ());
761+ assertTrue (taskBody .getOwners ().stream ().anyMatch (o -> o .getId ().getOwnerId ().equals (100L )));
749762 }
750763}
0 commit comments