File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1313import java .util .Set ;
1414
1515import static org .junit .jupiter .api .Assertions .*;
16+ import static org .mockito .ArgumentMatchers .any ;
1617import static org .mockito .ArgumentMatchers .anyLong ;
1718import static org .mockito .Mockito .verify ;
1819import static org .mockito .Mockito .when ;
@@ -50,23 +51,22 @@ void findById() {
5051 @ Test
5152 void save () {
5253 Visit visit = new Visit ();
53- when (visitRepository .save (visit )).thenReturn (visit );
54+ when (visitRepository .save (any ( Visit . class ) )).thenReturn (visit );
5455 Visit savedVisit = service .save (visit );
5556 assertNotNull (savedVisit );
5657 assertEquals (visit , savedVisit );
57- verify (visitRepository ).save (visit );
58+ verify (visitRepository ).save (any ( Visit . class ) );
5859 }
5960
6061 @ Test
6162 void delete () {
62- Visit visit = new Visit ();
63- service .delete (visit );
64- verify (visitRepository ).delete (visit );
63+ service .delete (new Visit ());
64+ verify (visitRepository ).delete (any (Visit .class ));
6565 }
6666
6767 @ Test
6868 void deleteById () {
69- service .deleteById (anyLong () );
69+ service .deleteById (1L );
7070 verify (visitRepository ).deleteById (anyLong ());
7171 }
7272}
You can’t perform that action at this time.
0 commit comments