UserResourceEndpointController { public Response getUser(String identifier) throws SCIMException { log.debug("Calling SCIM REST method getUser by id {}", identifier); if (identifier == null) { throw new NullPointerException("identifier is null"); } try { User perunUser = perunBl.getUsersManagerBl().getUserById(session, Integer.parseInt(identifier)); ObjectMapper mapper = new ObjectMapper(); return Response.ok(mapper.writeValueAsString(mapPerunUserToScimUser(perunUser))).build(); } catch (InternalErrorException ex) { log.warn("Internal exception occured while getting user with id {}.", identifier); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } catch (UserNotExistsException ex) { log.warn("User with id {} does not exists.", identifier); return Response.status(Response.Status.NOT_FOUND).build(); } catch (IOException ex) { throw new SCIMException("Cannot convert user resource to json string", ex); } } UserResourceEndpointController(PerunSession session); Response getUser(String identifier);  }
@Test public void testGetUser() throws Exception { UserSCIM user = prepareExpectedResult(); String expectedJson = mapper.writeValueAsString(user); Response expectedResponse = Response.ok(expectedJson).build(); Response result = controller.getUser(user.getId().toString()); if (result.getStatus() != 200) { fail(); } assertEquals("expected user should equal with result obtained from SCIM REST API", expectedResponse.getEntity(), result.getEntity()); }