Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PersonService(PersonDao personDao) {
- m_PersonDao = personDao;
- }
- public List<Person> getAll() {
- return m_PersonDao.getAll();
- }
- public void save(Person p) {
- if (!m_PersonDao.isExistingPerson(p)) {
- m_PersonDao.save(p);
- }
- }
- public Person getByName(String name) {
- return m_PersonDao.getByName(name);
- }
- public Person getByBirthYear(Integer year) {
- return m_PersonDao.getByBirthYear(year);
- }
- @Before
- public void setUp() throws Exception {
- }
- @After
- public void tearDown() throws Exception {
- }
- @Test
- public void testPersonService() {
- fail("Not yet implemented");
- }
- @Test
- public void testGetAll() {
- fail("Not yet implemented");
- }
- @Test
- public void testSave() {
- fail("Not yet implemented");//
- }
- @Test
- public void testGetByName() {
- PersonDao personDao = Mockito.mock(PersonDao.class);
- Mockito.when(personDao.getByName("john")).thenReturn(new Person("John Thomspon", 1856);
- Person p = personDao.getByName("john");
- assert (p.getName().equals("John Thomspon"));
- @Test
- public void testGetByBirthYear() {
- enter code here
- }
Add Comment
Please, Sign In to add comment