All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
First of all, we thank you for being keen to learn your religion and for refusing to cheat, as cheating is forbidden. The Prophet said: "Whoever cheats is not one of us." [Muslim] Therefore, you did well by avoiding what could lead to cheating.
You should have advised your class mates, as advice is the essence of religion, and you should have refused to take the examination paper that was given to you, because by accepting it, you are encouraging others to cheat. By refusing to take the test paper, you prevent yourself from cheating and prevent the devil from whispering to you and luring you to cheat.
To conclude, you acted in a correct way and you should avoid anything which could lead to cheating, and you should advise all Muslims.
For more benefit, please refer to Fatwa 86185.