After patiently waiting, Joseph is finally rewarded for his faithfulness. The difficulties he endures are exceptionally bad, but the reward he receives is exceptionally good! Verse 16 is amazing. Despite all he has been through, Joseph is still praising God.
In James 1:2-4, we are told to consider it joy when we experience trouble. Our troubles help to make us faithful, and our faithfulness makes us complete. It would be great if there were an easier way for God to perfect us, but God knows what is best!