use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method addUserAttributeByUserInum_newAttribute_user.
@Test
private void addUserAttributeByUserInum_newAttribute_user() {
String inumUser = "inumUser";
String attributeName = "attribute1";
String attributeValue = "value1";
User user = spy(getBasicUser("123", "dn123"));
user.setCustomAttributes(new ArrayList<>());
when(persistenceEntryManager.find(any(), any(), any())).thenReturn(user);
doNothing().when(persistenceEntryManager).merge(user);
User resultUser = userService.addUserAttributeByUserInum(inumUser, attributeName, attributeValue);
assertNotNull(resultUser);
assertTrue(resultUser.getCustomAttributes().size() == 1);
assertEquals(resultUser.getCustomAttributes().get(0).getName(), attributeName);
assertEquals(resultUser.getCustomAttributes().get(0).getValue(), attributeValue);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByInum_nullInum_null.
@Test
private void getUserByInum_nullInum_null() {
User user = userService.getUserByInum(null, null);
assertNull(user);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByAttributes_twoAttributes_user.
@Test
private void getUserByAttributes_twoAttributes_user() {
String userId = "123";
String baseDn = "baseDn";
List<CustomAttribute> attributes = new ArrayList<>();
CustomAttribute customAttribute1 = new CustomAttribute("attribute1", "value1");
CustomAttribute customAttribute2 = new CustomAttribute("attribute2", "value2");
attributes.add(customAttribute1);
attributes.add(customAttribute2);
when(persistenceEntryManager.findEntries(anyString(), any(), any(), any(), anyInt())).thenReturn(getListBasicOneUser(userId, baseDn));
User resultUser = userService.getUserByAttributes(attributes, true, null);
assertNotNull(resultUser);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByDn_emptyDn_null.
@Test
private void getUserByDn_emptyDn_null() {
User user = userService.getUserByDn("", null);
assertNull(user);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByInum_emptyInum_null.
@Test
private void getUserByInum_emptyInum_null() {
User user = userService.getUserByInum("", null);
assertNull(user);
}
Aggregations