The Prophet, peace and blessings of Allah be upon him, said:
“The greatness of reward is based on the severity of the trial. And if Allah loves a person, He tests him, so whoever is pleased (with Allah), then he will have the pleasure (of Allah), but whoever is angry, then he will receive the Anger (of Allah).” (Recorded in al-Tirmidhi)
So the fact that our du’a is not responded to is a trial from Allah, and this should make us optimistic that they we from amongst those that Allah loves. Such a test should therefore make us increase in patience and draw closer to Allah.