@Test
public void testGrantFactAccessBySubjectName() throws Exception {

  UUID currentUser = UUID.randomUUID();
  GrantFactAccessRequest request = createGrantAccessRequest();
  FactRecord fact = createFactRecord(request);
  when(factRequestResolver.resolveFact(request.getFact())).thenReturn(fact);
  when(subjectResolver.resolveSubject(subject.getName())).thenReturn(subject);
  when(objectFactDao.storeFactAclEntry(notNull(), notNull())).then(i -> i.getArgument(1));
  when(securityContext.getCurrentUserID()).thenReturn(currentUser);
  delegate.handle(request);
  verify(objectFactDao).storeFactAclEntry(same(fact), matchFactAclEntryRecord(currentUser));
  verify(subjectResolver).resolveSubject(subject.getName());
  verify(aclEntryResponseConverter).apply(matchFactAclEntryRecord(currentUser));
}