@Test public void noSelfIdResolverTest() { Principal principal = mock(Principal.class); SessionContext sessionContext = mock(SessionContext.class); @SuppressWarnings("unchecked") Instance<SelfIdResolver> selfIdResolverInstance = mock(Instance.class); when(sessionContext.getCallerPrincipal()).thenReturn(principal); when(principal.getName()).thenReturn("test-user"); when(selfIdResolverInstance.isUnsatisfied()).thenReturn(true); SelfResourceImpl selfResource = new SelfResourceImpl(); selfResource.selfIdResolver = selfIdResolverInstance; selfResource.sessionContext = sessionContext; Response response = selfResource.getSelf(null, null); assertThat(response.getEntity(), instanceOf(ErrorResponse.class)); List<String> messages = ((ErrorResponse)response.getEntity()).getErrorMessageList(); assertThat(messages, hasItem("Caller SelfIdResolver not available")); assertThat(messages, hasSize(1)); }
@Override public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) { try { String internalId = getInternalId(); return userResource.getById(internalId, attributes, excludedAttributes); } catch (UnableToResolveIdException e) { return createErrorResponse(e); } catch (ScimException e) { return createErrorResponse(e); } }
SelfResourceImpl implements SelfResource { @Override public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) { try { String internalId = getInternalId(); return userResource.getById(internalId, attributes, excludedAttributes); } catch (UnableToResolveIdException e) { return createErrorResponse(e); } catch (ScimException e) { return createErrorResponse(e); } } }
SelfResourceImpl implements SelfResource { @Override public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) { try { String internalId = getInternalId(); return userResource.getById(internalId, attributes, excludedAttributes); } catch (UnableToResolveIdException e) { return createErrorResponse(e); } catch (ScimException e) { return createErrorResponse(e); } }  }
SelfResourceImpl implements SelfResource { @Override public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) { try { String internalId = getInternalId(); return userResource.getById(internalId, attributes, excludedAttributes); } catch (UnableToResolveIdException e) { return createErrorResponse(e); } catch (ScimException e) { return createErrorResponse(e); } }  @Override Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response update(ScimUser resource, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response patch(PatchRequest patchRequest, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response delete(); }
SelfResourceImpl implements SelfResource { @Override public Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes) { try { String internalId = getInternalId(); return userResource.getById(internalId, attributes, excludedAttributes); } catch (UnableToResolveIdException e) { return createErrorResponse(e); } catch (ScimException e) { return createErrorResponse(e); } }  @Override Response getSelf(AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response update(ScimUser resource, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response patch(PatchRequest patchRequest, AttributeReferenceListWrapper attributes, AttributeReferenceListWrapper excludedAttributes); @Override Response delete();  }