@BeforeMethod public void init() { person = new Person((long) 0, "prema@podlaha", "pass"); person.setAdmin(true); person2 = new Person((long) 1, "podlaha@podlaha", "aaaa"); person2.setAdmin(false); personDTO = beanMappingService.mapTo(person, PersonDTO.class); personDTO2 = beanMappingService.mapTo(person2, PersonDTO.class); personDTOHash = new PersonDTO((long) 2, "admin", "admin"); personDTOHash.setAdmin(true); personHash = new Person((long) 2, "admin", PersonServiceImpl.createHash("admin")); personHash.setAdmin(true); }
/** 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); }