Psalm 16:8 (ESV)

8 I have set the LORD always before me; because he is at my right hand, I shall not be shaken.

David often found himself in precarious positions and must have often wondered how things would work out for him and the other righteous in Israel. Despite this, his faith was so strong that he could declare that he would not be shaken.