@POST
    @Consumes(MediaType.APPLICATION_JSON)
    public Response addAclRule(InputStream stream) {
        try {
            AclRule newRule = jsonToRule(stream);
            return get(AclService.class).addAclRule(newRule) ?
                    Response.created(new URI(newRule.id().toString())).build() :
                    Response.serverError().build();
        } catch (Exception e) {
            return Response.status(MULTI_STATUS_RESPONSE).entity(e.getMessage()).build();
        }
    }
@Test
    public void addRule() {
        mockAclService.addAclRule(anyObject());
        expectLastCall().andReturn(true).anyTimes();
        replay(mockAclService);

        WebTarget wt = target();
        InputStream jsonStream;

        jsonStream = AclWebResourceTest.class
                .getResourceAsStream("post-valid-acl.json");
        Response response = wt.path("rules").request(MediaType.APPLICATION_JSON_TYPE)
                .post(Entity.json(jsonStream));
        assertEquals(response.getLocation().getPath(), "/0x0");

    }