File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
Testing
Author
Junit test for synchronized method
Maria Laxmi
Ranch Hand
Joined: Aug 08, 2008
Posts: 40
posted
May 04, 2010 08:24:15
0
Hi,
Is there a good way to
test
that a method is synchronized in a
JUnit
test? I have used synchronized method for
J2EE
application.
Thanks,
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
May 04, 2010 08:28:55
0
Wouldn't you just test it like any other method?
Maria Laxmi
Ranch Hand
Joined: Aug 08, 2008
Posts: 40
posted
May 04, 2010 08:43:51
0
My concern is to test when multiple threads try to call synchronized method at the same time. Is there any way we can catch this scenario in Junit Testcase?
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
May 04, 2010 08:45:00
0
Sure; set up a bunch of threads and have them call it. But that seems like unit-testing the "synchronized" keyword to me.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Junit test for synchronized method
Similar Threads
Ant 1.7 + Junit 4 problems
naming conventions for junit 4.0
test geter and setter
Lock question!
how to test void method.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter