validAuthoritySearchResult = new SearchResult<Authority>(validAuthorityList, validAuthorityList.size());
}
@Test
public void createNewAccountTest() throws Exception {
UserImpl newUser = new UserImpl();
newUser.setUsername(VALID_USER);
newUser.setPassword(VALID_PASSWORD);
newUser.setConfirmPassword(VALID_PASSWORD);
newUser.setEmail(VALID_EMAIL);
newUser.setDefaultPageLayoutCode(VALID_LAYOUT_CODE);
User expectedUser = new UserImpl();
expectedUser.setUsername(newUser.getUsername());
expectedUser.setPassword(newUser.getPassword());
expectedUser.setEmail(newUser.getEmail());
expectedUser.setDefaultPageLayout(validPageLayout);
expectedUser.setExpired(false);
expectedUser.setLocked(false);
expectedUser.setEnabled(true);
ReflectionTestUtils.setField(newAccountService, "passwordEncoder", passwordEncoder);
expect(passwordEncoder.encode("valid.password")).andReturn("valid.password");
expect(userService.getUserByUsername(VALID_USER)).andReturn(null);