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

Chris Dyer
Chris Dyer
18,518 Points

Verification on final service test for findById.

More of a statement than a question. The final verification call in findById_ShouldThrowFavoriteNotFoundException:

    @Test(expected = FavoriteNotFoundException.class)
    public void testFindByIdNonExistantId() throws Exception {
        when(mockFavoriteDao.findOne(1l)).thenReturn(null);
        favoriteService.findById(1l);
        verify(mockFavoriteDao).findOne(1l);
    }

would never be ran as the thrown exception exits the test. You could add findOne(455l) and this test will still pass.