GeoServerSecurityManager secMgr = createNiceMock(GeoServerSecurityManager.class);
expect(secMgr.listAuthenticationProviders()).andReturn(new TreeSet<String>()).anyTimes();
GeoServerUserGroupService ugService1 = createNiceMock(GeoServerUserGroupService.class);
expect(ugService1.getName()).andReturn("test1").anyTimes();
expect(secMgr.loadUserGroupService("test1")).andReturn(ugService1).anyTimes();
GeoServerUserGroupService ugService2 = createNiceMock(GeoServerUserGroupService.class);
expect(ugService2.getName()).andReturn("test2").anyTimes();
expect(ugService2.getGroupCount()).andReturn(1).anyTimes();
expect(secMgr.loadUserGroupService("test2")).andReturn(ugService2).anyTimes();