7 During the days of Jesus’ life on earth, he offered up prayers and petitions with fervent cries and tears to the one who could save him from death, and he was heard because of his reverent submission. 8 Son though he was, he learned obedience from what he suffered 9 and, once made perfect, he became the source of eternal salvation for all who obey him — Hebrews 5:7-9 NIV
Jesus suffered many things in His walk here on earth. He was exposed to every temptation that we are exposed to but never sinned. Again, we sometimes forget that Jesus was completely human when he suffered these temptations. We need to be very careful in assuming that Jesus did not sin because He was all God as well as all man. He suffered as a human. His sufferings taught Him obedience because he was totally submitted to the will of His Father. We might say that Jesus knew He was going to be tempted and suffer here on earth, so He had an advantage. But if we read, study and really believe the Scriptures, we also know that we are going to suffer. The difference is that we often give into the desires of the flesh rather than trust our Father to deliver us. Suffering is not to let God know what our response will be, He already knows. It is so that we will know where we are in our walk with God. Our sufferings are not to be avoided, they are to be embraced. Testing and temptations are stepping stones to maturity and to help us become more intimate with Jesus.
2 Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything. – James 1:2-4 NIV
17 Now if we are children, then we are heirs—heirs of God and co-heirs with Christ, if indeed we share in his sufferings in order that we may also share in his glory.
18 I consider that our present sufferings are not worth comparing with the glory that will be revealed in us.
— Romans 8:17, 18 NIV