}
@Test
public void testChangePreferences() {
String userId = "userId";
UserInformation userInfoBeforeChange = implWithRealCryptoEngine.createAccount(userId, "masterPassword");
assertNull(userInfoBeforeChange.getPreferences().getLocale());
assertEquals(TimeZone.getTimeZone(MwConstants.GMT), userInfoBeforeChange.getPreferences().getTimeZone());
assertFalse(userInfoBeforeChange.getPreferences().isPasswordsUnmasked());
Locale newLocale = new Locale("fr", "FR");
TimeZone newTimeZone = TimeZone.getTimeZone("Europe/Paris");
implWithRealCryptoEngine.changePreferences(userId,
new Preferences(newLocale,
newTimeZone,
true,
new PasswordGenerationPreferences(4, false, true, false, true)));
UserInformation userInfoAfterChange =
implWithRealCryptoEngine.login(userId, "masterPassword");
assertEquals(newLocale, userInfoAfterChange.getPreferences().getLocale());
assertEquals(newTimeZone, userInfoAfterChange.getPreferences().getTimeZone());
assertTrue(userInfoAfterChange.getPreferences().isPasswordsUnmasked());
assertEquals(4, userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().getLength());
assertFalse(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isLowerCaseLettersIncluded());
assertTrue(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isUpperCaseLettersIncluded());
assertFalse(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isDigitsIncluded());
assertTrue(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isSpecialCharactersIncluded());
}