Jeremiah 11:20shaphat
But, O LORD of hosts, that judgest righteously, that triest the reins and the heart, let me see thy vengeance on them: for unto thee have I revealed my cause.
God is the one who judges righteously, testing heart and mind.
Psalms 51:4shaphat
Against thee, thee only, have I sinned, and done this evil in thy sight: that thou mightest be justified when thou speakest, and be clear when thou judgest.
David confesses sin, affirming God is right and clear when he judges.