The Lord tests the righteous, but the wicked and the one who loves violence His soul hates.
Psalm 11:5 (NKJV)
For You, O God, have tested us; You have refined us as silver is refined.
Psalm 66:10 (NKJV)
The Bible is full of test-takers. All of God's heroes were tested, especially Jesus. Why? Why must we suffer to enter the Kingdom of God? Why must we walk through gates made of pearl, the product of suffering? (See Revelation 21:21).
'And Moses said to the people, 'Do not fear; for God has come to test you, and that His fear may be before you, so that you may not sin' ' (Exodus 20:20).
Here's the thing: God 'tests the righteous.' He 'Disciplines the one He loves, and He chastens everyone He accepts as His son' (Hebrews 12:6). 'Chasten' means 'to discipline or correct by punishment' (Word English Dictionary).
So 'If you should suffer for righteousness' sake, you are blessed' (1 Peter 3:14). In distress, you are blessed. As muscles grow through resistance, so do your faith and strength.
Therefore, study hard. While the lawless 'Practice wicked work' (Psalm 141:4), 'Ungodliness' (Isaiah 32:6), and 'Deceit' (Romans 3:13)...
You who love God, 'Depart from evil and do good; seek peace and pursue it' (Psalm 34:14). Because 'He who practices righteousness is righteous, just as He is righteous' (1 John 3:7).
As far as suffering through your tests? 'My brethren, count it all joy when you fall into various trials' (James 1:2). God loves you especially much. He is growing your character. He is giving you an overcoming story. Soon, joy will chase away your pain.
Your test will become a testimony.