@Test
public void testCreateFactType() throws Exception {

  CreateFactTypeRequest request = createFactTypeRequest();
  FactTypeEntity newEntity = new FactTypeEntity();
  when(factManager.saveFactType(any())).thenReturn(newEntity);
  delegate.handle(request);
  verify(factTypeHelper).assertFactTypeNotExists(request.getName());
  verify(factTypeHelper).assertObjectTypesToBindExist(request.getRelevantObjectBindings(), "relevantObjectBindings");
  verify(factTypeHelper).convertFactObjectBindingDefinitions(request.getRelevantObjectBindings());
  verify(factTypeResponseConverter).apply(newEntity);
  verify(factManager).saveFactType(argThat(entity -> {
    assertCommonEntity(request, entity);
    assertEquals(1, entity.getRelevantObjectBindings().size());
    return true;
  }));
}