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