0

I have a spring bootproject with several services. Im writing junit test for a method that defines a service that reads value from database and updates it with the new value in the database. I want to do unit testing for the method by calling it in 10 different threads. How can this be done?

Rohan RM
  • 157
  • 1
  • 2
  • 10
  • In your test, start ten threads, have them each do what they need to do, then `join` them. Sprinkle assertions along the way (maybe within the threads, maybe after the `join`). – Thilo Dec 10 '18 at 10:41
  • 5
    what you want is an integration test, not an unit test. Testing multithreading only in the repository scope is probably not enough because transaction and logic have side effect on. – davidxxx Dec 10 '18 at 10:44

0 Answers0