/** Test of isAdmin method, of class PersonFacadeImpl. */ @Test public void testIsAdmin() { when(personDao.findById(person.getId())).thenReturn(person); Assert.assertEquals(personFacade.isAdmin(personDTO), person.isAdmin()); Assert.assertNotEquals(personFacade.isAdmin(personDTO), person2.isAdmin()); }
/** Test of authenticate method, of class PersonFacadeImpl. */ @Test public void testAuthenticate() { when(personDao.findByEmail(personHash.getEmail())).thenReturn(personHash); PersonAuthenticateDTO personAuthenticateDTO = new PersonAuthenticateDTO(); personAuthenticateDTO.setEmail(personDTOHash.getEmail()); personAuthenticateDTO.setPassword(personDTOHash.getPassword()); Assert.assertTrue(personFacade.authenticate(personAuthenticateDTO)); }
/** Test of findAll method, of class PersonFacadeImpl. */ @Test public void testFindAll() { List<Person> personList = new ArrayList<>(); personList.add(person); personList.add(person2); when(personDao.findAll()).thenReturn(personList); List<PersonDTO> newPersonDTOList = personFacade.findAllPersons(); Assert.assertEquals(beanMappingService.mapTo(personList, PersonDTO.class), newPersonDTOList); }
/** Test of findById method, of class PersonFacadeImpl. */ @Test public void testFindById() { when(personDao.findById(person.getId())).thenReturn(person); PersonDTO personDTOLoc = personFacade.findPersonById(person.getId()); Assert.assertEquals(beanMappingService.mapTo(person, PersonDTO.class), personDTOLoc); }
/** Test of edit method, of class PersonFacadeImpl. */ @Test public void testEdit() { when(personDao.findById(personDTO.getId())).thenReturn(person); personFacade.editPerson(personDTO); }