"Dear brothers and sisters, when troubles come your way, consider it an opportunity for great joy. For you know that when your faith is tested, your endurance has a chance to grow."

Definition for joy — something that brings deep happiness and contentment.

"Joy" - I think of I the sun shining, the birds chirping, my loved ones happy and at peace. Joy is not a word that normally comes to mind in times of trouble — losing a job, loved ones passing away, health concerns, etc.
God is calling us or giving us the opportunity to find joy when times are tough. I am not a runner — it never looked like much fun. But I do love to walk fast. I prefer to walk when the sun is warm, the sky is blue and the air is clear. But if I would wait for those perfect days - I would walk rarely and lose the opportunity to build up my endurance and the benefit. So I try to venture out in all weather elements. Some days it is very difficult.
We are never alone in the elements of life's troubles - God's Word reminds us over and over again He will never leave us or forsake us: Deut 31:8 The LORD himself goes before you and will be with you; he will never leave you nor forsake you. Do not be afraid; do not be discouraged.
What greater joy is there!

James 1:2