David had fought a few battles, all of which he won. After the battle with the Syrians the Word says he was recognized for the victories he had gained. People came to realize that David was a guy that was hard to defeat.
Without the battles he wouldn’t have gained the recognition.
The trying times we face aren’t useless. It’s in these times that we can make known who we are fighting for. Build a reputation that glorifies God.