public UserAccount createUserAccount( String username, String password, Employee employee, Role role) { UserAccount userAccount = new UserAccount(); userAccount.setUsername(username); userAccount.setPassword(password); userAccount.setEmployee(employee); userAccount.setRole(role); userAccountList.add(userAccount); return userAccount; }
@Test @UsingDataSet("users.json") @ShouldMatchDataSet("expected-users.json") public void should_change_user_password_using_json_data_sets() throws Exception { // given String expectedPassword = "******"; UserAccount user = em.find(UserAccount.class, 2L); // when user.setPassword("LexLuthor"); user = em.merge(user); // then assertThat(user.getPassword()).isEqualTo(expectedPassword); }
@Test @ApplyScriptBefore("users.sql") @ShouldMatchDataSet("expected-users.yml") public void should_change_password_using_sql_to_seed_data() throws Exception { // given String expectedPassword = "******"; UserAccount user = em.find(UserAccount.class, 2L); // when user.setPassword("LexLuthor"); user = em.merge(user); // then assertThat(user.getPassword()).isEqualTo(expectedPassword); }
public static Business initializeBusiness() { Business business = Business.getInstance(); // create an Employee Employee emp = business.getEmployeeDirectory().addEmployee(); emp.setFirstName("Hari"); emp.setLastName("Panjwani"); emp.setOrganization("NEU"); // add a user account UserAccount userAccount = business.getUserAccountDirectory().addUserAccount(); userAccount.setUserName("admin"); userAccount.setPassword("admin"); userAccount.setIsActive("Yes"); userAccount.setPerson(emp); userAccount.setRole(UserAccount.ADMIN_ROLE); return business; }