Yaakov passes away and the brothers get nervous. They fear that now that their father is no longer around, Yosef will take advantage and finally get his revenge for what they had done to him.
Yosef realizes their fears and he says in 50:20 "ואתם חשבתם עלי רעה אלקים חשבה לטבה" - you planned to do to me evil, yet Hashem turned it around for good.
Yosef, according to Rashi, was assuring them that they had nothing to worry about. He will not do anything to them anyway because only what Hashem wants can happen. If hashem wants bad to happen to you, he will find a way, and if He wants good so even if I plan bad it will not be successful. Just like when you planned bad for me and it turned out good.
Yosef learned an amazing lesson from a tragic story that happened to him. he was treated horribly by his brothers. yet he held no ill feelings toward them because he realized they were only the middle men involved and it was really from Hashem. Because of that there is not even a point in trying to harm someone else, because it is all up to Hashem.
Yosef had an amazing level of bitachon.