def METHOD_NAME(self):
    doc1 = api.content.create(type="Document", title="doc1", container=self.portal)
    doc2 = api.content.create(type="Document", title="doc2", container=self.portal)
    doc3 = api.content.create(type="Document", title="doc3", container=self.portal)
    intids = getUtility(IIntIds)
    doc1_intid = intids.getId(doc1)
    doc2_intid = intids.getId(doc2)
    doc3_intid = intids.getId(doc3)
    api.relation.create(doc1, doc2, "relatedItems")
    api.relation.create(doc1, doc3, "relatedItems")
    stats, broken = get_relations_stats()
    self.assertEqual(dict(stats), {"relatedItems": 2})
    self.assertEqual(dict(broken), {})
    rebuild_relations(flush_and_rebuild_intids=True)
    # Relations are the same after a rebuild.
    stats, broken = get_relations_stats()
    self.assertEqual(dict(stats), {"relatedItems": 2})
    self.assertEqual(dict(broken), {})
    # intids are now changed.
    doc1_intid_after = intids.getId(doc1)
    doc2_intid_after = intids.getId(doc2)
    doc3_intid_after = intids.getId(doc3)
    self.assertNotEqual(doc1_intid, doc1_intid_after)
    self.assertNotEqual(doc2_intid, doc2_intid_after)
    self.assertNotEqual(doc3_intid, doc3_intid_after)
    # Break a relation.
    self.portal._delObject("doc2")
    stats, broken = get_relations_stats()
    self.assertEqual(dict(stats), {"relatedItems": 1})
    self.assertEqual(dict(broken), {"relatedItems": 1})
    # Broken relations are gone after rebuilding.
    rebuild_relations(flush_and_rebuild_intids=True)
    stats, broken = get_relations_stats()
    self.assertEqual(dict(stats), {"relatedItems": 1})
    self.assertEqual(dict(broken), {})