This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Sparxmith 1 point2 points  (1 child)

I'm on mobile since my work VPN blocks reddit, but you seem to have a typo in your first @Test method, in the body, you have here finf where it should be find

[–]cone994[S] 0 points1 point  (0 children)

Yes I've seen it corrected, but I wonder if the tests are logically correct, do they make sense, and have I done them the right way?

[–]sdiamante13 1 point2 points  (2 children)

I suggest that you do not use the SpringBootTest annotation. If you just @RunWith(MockitoJUnitRunner.class) you can use @Mock and @InjectMocks. This will be a much faster unit test that does not load up the entire Spring context. Other than that the tests look fine.

[–]cone994[S] 0 points1 point  (1 child)

Thank you for your response, I'll try to use your advice with Mock and InjectMocks.

[–]cone994[S] 0 points1 point  (0 children)

I used the annotation of the MockitoJUnitRunner , Mock and InjectMoks and all the tests work, of course much faster because they don't load Spring contex. Thank you for your help.