Narrated Abdullah bin Umar (may Allah be pleased with them): The Prophet Muhammad (peace be upon him) said: Three men were traveling when suddenly it began to rain. They took shelter in a cave in a mountain. By chance, a rock from above rolled down and blocked the mouth of the cave in which they had taken refuge. One of them said to the others, “Mention the best deed you have ever done and supplicate to Allah by its name.” So one of them prayed, “O Allah! My parents were very old. I used to take my cattle out to graze. When I returned in the evening, I would milk the animals and present the milk in a vessel first to my parents. When they had drunk, then I would give it to my children and my wife. One night, I was delayed on my return, and when I reached home, my parents had already fallen asleep. I did not like to wake them up, and my children were crying with hunger at my feet. I stood with the bowl of milk in my hand before my parents until morning came. O Allah! If I did this only to seek Your pleasure, then remove this rock for us so that we may at least see the sky.” The Prophet (peace be upon him) said: So the rock moved a little.
The second man said, “O Allah! You know that I loved my uncle’s daughter as much as a man can love a woman. She said, ‘You cannot fulfill your desire with me unless you give me one hundred dinars.’ I tried to collect them and finally gathered the required amount. When I sat between her legs, she said, ‘Fear Allah and do not break the seal unlawfully.’ So I stood up and left her. O Allah! If I did this only to seek Your pleasure, then make a way for us to get out.” The Prophet (peace be upon him) said: So the rock moved two-thirds.
The third man said, “O Allah! You know that I once hired a laborer for a measure of millet. When I gave him his wages, he refused to take them. I sowed that millet, and from its yield, I bought a cow and a shepherd. After some time, the laborer returned and asked for his wages, saying, ‘O servant of Allah, give me my right.’ I said, ‘Go to that cow and the shepherd, for they are yours.’ He said, ‘Are you mocking me?’ I said, ‘I am not mocking you; they are truly yours.’ O Allah! If I did this only to seek Your pleasure, then remove this rock for us.” So the cave opened completely, and all three men came out.