@Test public void shouldNotChangePasswordWithoutOldPassword() { motechUserService.register( "userName", "password", "1234", "", asList("IT_ADMIN", "DB_ADMIN"), Locale.ENGLISH); motechUserService.changePassword("userName", "foo", "newPassword"); MotechUser motechUser = usersDataService.findByUserName("userName"); assertTrue(passwordEncoder.isPasswordValid(motechUser.getPassword(), "password")); }
@Test public void testPasswordEncoding() { String plainTextPassword = "******"; motechUserService.register( "testuser", plainTextPassword, "entity1", "", asList("ADMIN"), Locale.ENGLISH); MotechUser motechUser = usersDataService.findByUserName("testuser"); assertTrue(passwordEncoder.isPasswordValid(motechUser.getPassword(), plainTextPassword)); }