Narrated Ibn `Umar
Allah's Messenger (ﷺ) said, "Once three persons (from the previous nations) were traveling, and suddenly it started raining and they took shelter in a cave. The entrance of the cave got closed while they were inside. They said to each other, 'O you! Nothing can save you except the truth, so each of you should ask Allah's Help by referring to such a deed as he thinks he did sincerely (i.e. just for gaining Allah's Pleasure).' So one of them said, 'O Allah! You know that I had a laborer who worked for me for one Faraq (i.e. three Sas) of rice, but he departed, leaving it (i.e. his wages). I sowed that Faraq of rice and with its yield I bought cows (for him). Later on when he came to me asking for his wages, I said (to him), 'Go to those cows and drive them away.' He said to me, 'But you have to pay me only a Faraq of rice,' I said to him, 'Go to those cows and take them, for they are the product of that Faraq (of rice).' So he drove them. O Allah! If you consider that I did that for fear of You, then please remove the rock.' The rock shifted a bit from the mouth of the cave. The second one said, 'O Allah, You know that I had old parents whom I used to provide with the milk of my sheep every night. One night I was delayed and when I came, they had slept, while my wife and children were crying with hunger. I used not to let them (i.e. my family) drink unless my parents had drunk first. So I disliked to wake them up and also disliked that they should sleep without drinking it, I kept on waiting (for them to wake) till it dawned. O Allah! If You consider that I did that for fear of you, then please remove the rock.' So the rock shifted and they could see the sky through it. The (third) one said, 'O Allah! You know that I had a cousin (i.e. my paternal uncle's daughter) who was most beloved to me and I sought to seduce her, but she refused, unless I paid her one-hundred Dinars (i.e. gold pieces). So I collected the amount and brought it to her, and she allowed me to sleep with her. But when I sat between her legs, she said, 'Be afraid of Allah, and do not deflower me but legally. 'I got up and left the hundred Dinars (for her). O Allah! If You consider that I did that for fear of you than please remove the rock. So Allah saved them and they came out (of the cave)."