@Test
public void testUpdateOriginOrganization() throws Exception {

  OriginEntity entity = new OriginEntity()
          .setId(UUID.randomUUID());
  UpdateOriginRequest request = new UpdateOriginRequest()
          .setId(entity.getId())
          .setOrganization(UUID.randomUUID());
  when(originResolver.apply(entity.getId())).thenReturn(entity);
  when(securityContext.getAvailableOrganizationID()).thenReturn(Collections.singleton(request.getOrganization()));
  delegate.handle(request);
  verify(securityContext).checkPermission(TiFunctionConstants.updateThreatIntelOrigin, request.getOrganization());
  verify(originManager).saveOrigin(argThat(origin -> Objects.equals(request.getOrganization(), origin.getOrganizationID())));
}