@Override
    public Response toResponse(MissingCapabilitiesException exception) {
        final Map<String, Object> error = ImmutableMap.of(
                "error", "Unable to execute this search, the following capabilities are missing:",
                "missing", exception.getMissingRequirements()
        );
        return Response.status(Response.Status.CONFLICT).entity(error).build();
    }
@SuppressWarnings("unchecked")
    @Test
    public void mapsValidException() {
        Response response = sut.toResponse(new MissingCapabilitiesException(requirementsMap("one", "two")));

        assertThat(response.getStatus()).isEqualTo(409);

        Map payload = (Map) response.getEntity();
        assertThat(payload).containsOnlyKeys("error", "missing");
        assertThat((String) payload.get("error")).contains("capabilities are missing");
        assertThat((Map) payload.get("missing")).containsOnlyKeys("one", "two");
    }