List of usage examples for org.apache.commons.collections4 MapUtils EMPTY_SORTED_MAP
SortedMap EMPTY_SORTED_MAP
To view the source code for org.apache.commons.collections4 MapUtils EMPTY_SORTED_MAP.
Click Source Link
From source file:org.ligoj.app.plugin.id.ldap.dao.UserLdapRepositoryTest.java
@SuppressWarnings("unchecked") @Test// w w w .j a va 2s . c o m public void testBlockedUserByPpolicy() { final UserOrg user = new UserOrg(); final LdapTemplate mock = Mockito.mock(LdapTemplate.class); final DirContextOperations dirCtx = Mockito.mock(DirContextOperations.class); Mockito.when(mock.search((String) ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq(2), ArgumentMatchers.any(), (AbstractContextMapper<UserOrg>) ArgumentMatchers.any())).thenAnswer(i -> { ((AbstractContextMapper<DirContextOperations>) i.getArgument(4)).mapFromContext(dirCtx); user.setLocked(new Date(1517908964000L)); user.setLockedBy("_ppolicy"); return Collections.singletonList(user); }); Mockito.when(dirCtx.getDn()).thenReturn(org.springframework.ldap.support.LdapUtils.newLdapName("cn=Any")); Mockito.when(dirCtx.attributeExists(ArgumentMatchers.any())).thenReturn(true); Mockito.when(dirCtx.getStringAttribute(ArgumentMatchers.any())).thenReturn("20180206102244Z"); repository.setTemplate(mock); final Map<String, GroupOrg> groups = MapUtils.EMPTY_SORTED_MAP; repository.findAllNoCache(groups); Assertions.assertEquals(1517908964000L, user.getLocked().getTime()); }