Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 997
  • Last Modified:

Synchronized method - testing junit

I have a method which was not threadsafe, i have now Synchronized  it.

Just wondering if i can use Junit it prove that it now working syncronsouly ? I was thinking of instantiating a few threads and then invoking the method.....but not sure this is the correct way.

Just need a Junit test to prove that the method is now Synchronized

thanks
0
Molko
Asked:
Molko
  • 2
1 Solution
 
sciuriwareCommented:
Your tests should reflect a worst case scenario of a life situation.
JUNIT is not enough in this case.
You should prove that a 'random rain' of calls on this method doesn't
lead to hangs or race conditions.

So, what's the purpose of the method.
Don't answer, just think and analyse.

;JOOP!
0
 
sciuriwareCommented:
:)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now