コード例 #1
0
 @Test
 public void findByUserNameShouldBeCaseInsensitive() {
   String userName = "******";
   allMotechUsers.add(
       new MotechUserCouchdbImpl(userName, "testpassword", "", "id", asList("ADMIN"), ""));
   assertNotNull(allMotechUsers.findByUserName("TESTUSER"));
 }
コード例 #2
0
 @Test
 public void findByUserName() {
   MotechUser motechUser =
       new MotechUserCouchdbImpl("testuser", "testpassword", "", "id", asList("ADMIN"), "");
   allMotechUsers.add(motechUser);
   MotechUser testUser = allMotechUsers.findByUserName("testuser");
   assertEquals("testuser", testUser.getUserName());
 }
コード例 #3
0
 @Test
 public void shouldNotCreateNewAccountIfUserAlreadyExists() {
   String userName = "******";
   allMotechUsers.add(
       new MotechUserCouchdbImpl(userName, "testpassword", "", "id", asList("ADMIN"), ""));
   allMotechUsers.add(
       new MotechUserCouchdbImpl(userName, "testpassword1", "", "id2", asList("ADMIN"), ""));
   MotechUser motechUser = allMotechUsers.findByUserName("userName");
   final List<MotechUserCouchdbImpl> allWebUsers =
       ((AllMotechUsersCouchdbImpl) allMotechUsers).getAll();
   final int numberOfUsersWithSameUserName =
       Lambda.select(allWebUsers, HasPropertyWithValue.hasProperty("userName", equalTo(userName)))
           .size();
   assertEquals(1, numberOfUsersWithSameUserName);
   assertEquals("testpassword", motechUser.getPassword());
   assertEquals("id", motechUser.getExternalId());
 }
コード例 #4
0
 @Test
 public void findByUseridShouldReturnNullIfuserNameIsNull() {
   assertNull(null, allMotechUsers.findByUserName(null));
 }