Why Pain?

James 1:2-4 NASB

2 Consider it all joy, my brethren, when you encounter various trials, 3 knowing that the testing of your faith produces endurance. 4 And let endurance have its perfect result, so that you may be perfect and complete, lacking in nothing.