@Test public void findByUnknownId() { when(dao.findById(2)).thenReturn(null); Employment result = service.findById(2); verify(dao).findById(2); assertNull(result); }
@Test public void findById() { Employment employment = EmploymentDaoJpaTest.createEmployment(1, "Test Employment One"); when(dao.findById(1)).thenReturn(employment); Employment employmentTest = service.findById(1); verify(dao).findById(1); assertSame(employment, employmentTest); }