In ancient Greece and Rome, many prominent thinkers subscribed to a philosophy called Stoicism. As part of this philosophy, they practiced a thought exercise called premeditatio malorum, which means premeditation of evils.
It simply means taking a moment to think through everything that could go wrong with a particular plan. It means visualizing a bad future.
The idea behind premeditatio malorum is that by contemplating calamity, we rob future hardships of their bite and appreciate what we have now. In other words, anticipating adversity is likely to diminish its power on us when it actually strikes.