@Test public void updateUserIT() { final String newEmailAddress = "*****@*****.**"; final String changedLastName = "Darko"; final String userName = "******"; final ContactDTO contactDTO = createContactDTO("Marcel", "Becker", "56076", "Koblenz", "Am Kratzkopfer Hof 1"); final UserDTO userDTO = CreateUserDTO(userName, "12345", "*****@*****.**", contactDTO); final UserDTO response = userServiceBean.addUser(userDTO); Assert.assertNotNull(response); final UserDTO gotUserDTO = userServiceBean.getUserByUserName(userName); Assert.assertNotNull(gotUserDTO); gotUserDTO.setEmailAddress(newEmailAddress); gotUserDTO.getContactDTO().setLastName(changedLastName); userServiceBean.updateUser(gotUserDTO); final UserDTO changedUser = userServiceBean.getUserByUserName(userName); Assert.assertNotNull(changedUser); Assert.assertEquals(newEmailAddress, changedUser.getEmailAddress()); Assert.assertEquals(changedLastName, changedUser.getContactDTO().getLastName()); }
@Test public void getUserByUserNameIT() { final String userName = "******"; final ContactDTO contactDTO = createContactDTO("Marcel", "Becker", "56076", "Koblenz", "Am Kratzkopfer Hof 1"); final UserDTO userDTO = CreateUserDTO(userName, "12345", "*****@*****.**", contactDTO); final UserDTO response = userServiceBean.addUser(userDTO); Assert.assertNotNull(response); final UserDTO gotUserDTO = userServiceBean.getUserByUserName(userName); Assert.assertNotNull(gotUserDTO); }
@Test(expected = IllegalArgumentException.class) public void getUserByUserNameNotExistsIT() { final String userName = "******"; userServiceBean.getUserByUserName(userName); }