Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

verify(service).findAll() because this method call was not verified?

This is regarding: https://teamtreehouse.com/library/mocking-with-mockito

@ 5:44 the teacher says: Now it's important to note here that the last assertion this one right here checks to see that the model's list matches the one that we created above. It does not check to see whether or not the services find all method was actually called this is important too though.

I thought: It is the call to the service.findAll() method that gives the model.addAttributes the Favorites list. So when we check: .andExpect(model().attribute("favorites", favorites)); and it matches our service mocks Favorites List, that we are SURE that the service.findAll() method was called. How else can the Favorites lists match?

So if so, the verify(service).findAll(); is redundant??