Allah puts even His pious servants through difficulty but He ensures that they emerge unscathed. The story of Yusuf (alaihis salaam) bears testimony to this; he underwent separation from his father, attempted murder and imprisonment. At the end of it, Allah made him become a person of standing in Egypt.
His shirt (robe) features thrice. Once when his brothers put him in a well, they went to their father with his shirt covered in blood of an animal and told their father that a wolf had eaten him. Their father knew they were lying because the shirt was not torn. It must have been an amazing wolf that drew blood, snatched his son and did not tear the shirt!
When the lady in whose house Yusuf (alaihis salaam) was staying in Egypt tried to seduce him, he tried to get away and she tore his shirt from the back. When she accused him of trying to rape her, a person from her household said if the shirt was torn from the front then Yusuf (alaihis salaam) was guilty as she tried to defend herself. If it was torn from the back, then he tried to escape her and she grabbed at him. In trying circumstances, Allah let a shirt clear his servant of this charge.
When his brothers found him, Yusuf (alaihis salaam) sent his shirt to put on his father’s eyes so that his sight, which had gone out of grief for Yusuf (alaihis salaam), might return.
The second case illustrates a principle: Allah will make a way out for a person who lives his life according to His wishes in a manner he might not anticipate.