@Test
public void testGrantFactAccess() throws Exception {

  UUID fact = UUID.randomUUID();
  UUID subject = UUID.randomUUID();
  UUID entry = UUID.randomUUID();
  when(getTiService().grantFactAccess(any(), isA(GrantFactAccessRequest.class))).then(i -> {
    GrantFactAccessRequest request = i.getArgument(1);
    assertEquals(fact, request.getFact());
    assertEquals(subject.toString(), request.getSubject());
    return AclEntry.builder().setId(entry).build();
  });
  Response response = target(String.format("/v1/fact/uuid/%s/access/%s", fact, subject)).request().post(Entity.json(new GrantFactAccessRequest()));
  assertEquals(201, response.getStatus());
  assertEquals(entry.toString(), getPayload(response).get("id").textValue());
  verify(getTiService(), times(1)).grantFactAccess(notNull(), isA(GrantFactAccessRequest.class));
}