@Test
 public void testDisabled() {
   endpoints.setEnabled(false);
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Illegal operation."));
   endpoints.findUsers("id eq \"foo\"", "ascending", 0, 100, false);
 }
 @SuppressWarnings("unchecked")
 @Before
 public void init() {
   endpoints.setScimUserEndpoints(scimUserEndpoints);
   endpoints.setEnabled(true);
   when(securityContextAccessor.getAuthorities()).thenReturn(authorities);
   when(securityContextAccessor.getAuthenticationInfo()).thenReturn("mock object");
   when(provisioning.retrieveActive(anyString()))
       .thenReturn(
           Collections.singletonList(MultitenancyFixture.identityProvider("test-origin", "uaa")));
   endpoints.setSecurityContextAccessor(securityContextAccessor);
 }
 @Test
 public void noActiveIdps_ReturnsEmptyResources() throws Exception {
   when(provisioning.retrieveActive(anyString())).thenReturn(Collections.emptyList());
   SearchResults<?> searchResults =
       endpoints.findUsers("username eq \"foo\"", "ascending", 0, 100, false);
   assertTrue(searchResults.getResources().isEmpty());
 }
 @Test
 public void testBadFilter1() {
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Wildcards are not allowed in filter."));
   endpoints.findUsers("id co \"foo\"", "ascending", 0, 100, false);
 }
 @Test
 public void testGoodFilter1() {
   endpoints.findUsers(
       "(id eq \"foo\" or username eq \"bar\") and origin eq \"uaa\"", "ascending", 0, 100, false);
 }
 @Test
 public void testBadFilterWithGroup() {
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Invalid filter"));
   endpoints.findUsers("groups.display eq \"foo\"", "ascending", 0, 100, false);
 }
 @Test
 public void testBadFieldInFilter() {
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Invalid filter"));
   endpoints.findUsers("emails.value eq \"[email protected]\"", "ascending", 0, 100, false);
 }
 @Test
 public void testHappyDay() {
   endpoints.findUsers("userName eq \"marissa\"", "ascending", 0, 100, false);
 }
 @Test
 public void testBadFilter9() {
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Invalid filter"));
   endpoints.findUsers("origin eq \"uaa\"", "ascending", 0, 100, false);
 }
 @Test
 public void testBadFilter8() {
   expected.expect(ScimException.class);
   expected.expectMessage(containsString("Invalid operator."));
   endpoints.findUsers("id le \"foo\"", "ascending", 0, 100, false);
 }