'lema'an anoischo lenasoischo loda'as es asher bilvovcho lishmor mitsvoisov im loi' ' (8:2) ...in order to afflict you so as to test you, to know what is in your heart, whether you would observe His commandments or not'.
Hashem's tests in the midbar where in order to test klal yisroel, to bring out what was truly in their heart. Unfortunately, nowadays, in so many areas of avodas Hashem, so many of us are lacking in sincerity, out heart is not in the right place even if we are doing the right thing, it could be chesed or davening etc...
Hashem's nisyonos for us are to test what's really in our heart, is it true and genuine or is it only lip service. Instead of needing afflictions to bring out our deepest, genuine desires for good, if we would only fill our hearts with good and train ourselves to genuinely try to connect to Hashem and do His will all the time - even on a desert island - it would already be obvious where our hearts lay and we wouldn't need wake up calls all the time.
Perhaps every time we see a trigger, Hashem is asking us 'are you with Me, or are you with her?' If we would live with Him all the time, perhaps we wouldn't need to be asked this question...