Asking how to do JUnit testing is a little like asking how to program: it's a complex issue. Can you give us some more context? Have you been told to "add testing" to your program by a teacher or employer? Is this for your own research? Are you using an
IDE? Which one? Are you using
Maven? Gradle? Is this for a company that runs CI (continuous integration)? In other words, is this part of a larger software development system or just for you?
After we determine your development environment, you would start writing unit tests. This is a new program that will run your tests for the original program. (You actually test methods). I would start with very simple tests and build from there.
A JUnit tutorial would be a good place to start. I would start by googling
junit 5 tutorial for beginners. Sorry, I can't recommend any specific one; I'm not familiar with them.