If you read the Qur’an you will see that all the Prophets went through trials and tribulations. Life is a test so let us learn from the best examples of our Prophets.
“Or think you that you will enter Paradise without such (trials) as came to those who passed away before you? They were afflicted with severe poverty, ailments and were shaken.” (Qur’an 2:214)
We should know that if we are pleased with our Lord, He will be pleased with us. And if you are pleased with your Lord no matter what the situation is, then you will find that you have earned your Lord’s pleasure.
On the other hand, there are hypocrites whom Allah rejects their deeds. They are displeased with what Allah sends down and they hate seeking His pleasure; thus their deeds are performed in vain.