### Question:
UserManagerServiceImpl extends HibernateDaoImpl implements UserManagerService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public void disableAll(ExecutionContext context, List<String> users) { if (users != null) { for(String userName : users) { if (userName != null && userName.length() > 0) { enableOrDisableUser(context, userName, false); } } } }  @Transactional(propagation = Propagation.REQUIRED, readOnly = false) void updateUser(ExecutionContext context, String userName, User userDetails,
                                 Set<Role> assignedRoleSet, Set<Role> unassignedRoleSet); @Transactional(propagation = Propagation.REQUIRED, readOnly = false) void enableAll(ExecutionContext context, List<String> users); @Transactional(propagation = Propagation.REQUIRED, readOnly = false) void disableAll(ExecutionContext context, List<String> users); @Transactional(propagation = Propagation.REQUIRED, readOnly = false) void deleteAll(ExecutionContext context, List<String> users); void setUserService(UserAuthorityService userService);  }### Answer:
@Test public void disableAll() { List<String> users = new ArrayList<String>(); users.add(demo); users.add(first); users.add(second); when(userService.getUser(null, demo)).thenReturn(clone(demoUser)); when(userService.getUser(null, first)).thenReturn(clone(firstUser)); when(userService.getUser(null, second)).thenReturn(clone(secondUser)); managerService.disableAll(null, users); verify(userService, times(1)).getUser(null, demo); verify(userService, times(1)).getUser(null, first); ArgumentCaptor<User> updatedFirstUser = ArgumentCaptor.forClass(User.class); verify(userService, times(1)).updateUser(eq(null), eq(first), updatedFirstUser.capture()); assertNotEquals(firstUser.isEnabled(), updatedFirstUser.getValue().isEnabled()); verify(userService, times(1)).getUser(null, second); }
@Test public void disableAllIfNull() { managerService.disableAll(null, null); }
@Test public void disableAllIfEmptyList() { managerService.disableAll(null, new ArrayList<String>()); }
@Test public void disableAllIfListWithNullAndEmptyValue() { List<String> users = new ArrayList<String>(); users.add(null); users.add(""); managerService.disableAll(null, users); }