@Test
public void testCreateOriginWithAllFields() throws Exception {

  CreateOriginRequest request = new CreateOriginRequest()
          .setOrganization(UUID.randomUUID())
          .setName("name")
          .setDescription("description")
          .setTrust(0.1f);
  when(securityContext.getAvailableOrganizationID()).thenReturn(Collections.singleton(request.getOrganization()));
  when(originManager.saveOrigin(notNull())).thenReturn(new OriginEntity());
  delegate.handle(request);
  verify(securityContext).checkPermission(TiFunctionConstants.addThreatIntelOrigin, request.getOrganization());
  verify(originResponseConverter).apply(notNull());
  verify(originManager).saveOrigin(argThat(entity -> {
    assertNotNull(entity.getId());
    assertNotNull(entity.getNamespaceID());
    assertEquals(request.getOrganization(), entity.getOrganizationID());
    assertEquals(request.getName(), entity.getName());
    assertEquals(request.getDescription(), entity.getDescription());
    assertEquals(request.getTrust(), entity.getTrust(), 0.0);
    assertEquals(OriginEntity.Type.Group, entity.getType());
    return true;
  }));
}