に vs を use in sentence


I have a question, if I understand correctly, the use of を indicates the
direct object of the verb, I saw a lesson on my Japanese classes that has this
sentences:

> しけんに合格する

So, my question is that if the exam is the thing the person passes why is that
を is not used here.

