The same way you've always done
Check out all fruits and veggies to determine their freshness, by sight and feel. Check for bruises or breaks. Smell, heft, squeeze (lightly!), etc. When it comes to already packaged, canned, or boxed, you rely on a brand you trust, the provenance, the price, the nutrition label. If it passes your muster, buy it. If it turns out to be less than expected, don't buy it again.