So if anyone is tested with this type of plotting,  then let him fear Allaah, seek His aid and have patience. For verily, the final good end is for Taqwaa (i.e. those who fear and are obedient to Allaah).
This is as Allaah, the Most High, says. After narrating the story of Yoosuf and what befell him from the different types of abuse he received from his brothers in their evil plotting and conspiracy (against him), He says:
“Thus, did We establish Yoosuf in the land” 
And Allaah says, reporting from him that he said to his brothers:
“I am Yoosuf and this is my brother (Benjamin). Allaah has indeed been gracious to us.” 
And He, the Most High, tells us of story of Moosaa and what befell him and his people from the abuse they received at the hands of Pharaoh and his evil planning, and that he (Moosaa) said (to his followers):
“Seek help in Allaah and be patient. Verily, the earth belongs to Allaah. He gives it to whom He wills of His servants. And the final (good) end is for those who have Taqwaa” 
Furthermore, Allaah informed us that the bad consequences of evil plotting fall back upon the one who plotted the evil (in the first place), as He says:
“But the evil plot encompasses only he who makes it.” 
And Allaah says:
“And thus We have set up in every town, great ones of its wicked people to plot therein. But they plot not except against their own selves, yet they perceive not.” 
Furthermore, the actual facts also bear witness to this. For indeed, if someone carefully investigates the information of the people and the history of the world, he will come upon occurrences where someone plotted against his brother, but the plot fell back onto him. And astonishingly that served as a means for his salvation and deliverance.
And if we were to mention some of the events that did occur with regard to that, this book would be prolonged and the talk would be lengthened. Thus, Allaah is the One who grants what is correct and it is upon Him to explain the correct Way. And He is sufficient for us and the best of Guardians. May the peace and blessings of Allaah be upon Muhammad, his family and his companions.
 Meaning he is tested by it at the hands of someone else.
 Surah Yoosuf: 21
 Surah Yoosuf: 90
 Surat-ul-A’raaf: 128
 Surah Faatir: 43
 Surat-ul-An’aam: 123