File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 99import org .mockito .junit .jupiter .MockitoExtension ;
1010
1111import static org .junit .jupiter .api .Assertions .*;
12+ import static org .mockito .Mockito .*;
1213
1314@ ExtendWith (MockitoExtension .class )
1415class SpecialitySDJpaServiceTest {
@@ -22,6 +23,34 @@ class SpecialitySDJpaServiceTest {
2223 @ Test
2324 void deleteById () {
2425 service .deleteById (1L );
26+ service .deleteById (1L );
27+
28+ verify (specialtyRepository , times (2 )).deleteById (1L );
29+ }
30+
31+ @ Test
32+ void deleteByIdAtLeast () {
33+ service .deleteById (1L );
34+ service .deleteById (1L );
35+
36+ verify (specialtyRepository , atLeastOnce ()).deleteById (1L );
37+ }
38+
39+ @ Test
40+ void deleteByIdAtMost () {
41+ service .deleteById (1L );
42+ service .deleteById (1L );
43+
44+ verify (specialtyRepository , atMost (5 )).deleteById (1L );
45+ }
46+
47+ @ Test
48+ void deleteByIdNever () {
49+ service .deleteById (1L );
50+ service .deleteById (1L );
51+
52+ verify (specialtyRepository , atMost (5 )).deleteById (1L );
53+ verify (specialtyRepository , never ()).deleteById (5L );
2554 }
2655
2756 @ Test
You can’t perform that action at this time.
0 commit comments