@Test
 public void shouldCreateActiveUserByDefault() {
   motechUserService.register(
       "userName", "password", "1234", "", asList("IT_ADMIN", "DB_ADMIN"), Locale.ENGLISH);
   MotechUser motechUser = usersDataService.findByUserName("userName");
   assertEquals(UserStatus.ACTIVE, motechUser.getUserStatus());
 }
 @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));
 }
 @Test
 public void testRegister() {
   motechUserService.register(
       "userName", "password", "1234", "", asList("IT_ADMIN", "DB_ADMIN"), Locale.ENGLISH);
   MotechUser motechUser = usersDataService.findByUserName("userName");
   assertNotNull(motechUser);
   assertTrue(motechUser.getRoles().contains("IT_ADMIN"));
   assertTrue(motechUser.getRoles().contains("DB_ADMIN"));
 }
 @Test
 public void shouldCreateBlockedUser() {
   motechUserService.register(
       "userName",
       "password",
       "1234",
       "",
       asList("IT_ADMIN", "DB_ADMIN"),
       Locale.ENGLISH,
       UserStatus.BLOCKED,
       null);
   MotechUser motechUser = usersDataService.findByUserName("userName");
   assertEquals(UserStatus.BLOCKED, motechUser.getUserStatus());
 }
 @Test
 public void shouldNotActivateInvalidUser() {
   motechUserService.register(
       "userName",
       "password",
       "1234",
       "",
       asList("IT_ADMIN", "DB_ADMIN"),
       Locale.ENGLISH,
       UserStatus.BLOCKED,
       null);
   motechUserService.activateUser("userName1");
   MotechUser motechUser = usersDataService.findByUserName("userName");
   assertFalse(motechUser.isActive());
 }