Signed-off-by: Tomek Grabiec <[email protected]>
---
regression/jvm/SynchronizationTest.java | 56 +++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/regression/jvm/SynchronizationTest.java
b/regression/jvm/SynchronizationTest.java
index b1f13e2..de418a6 100644
--- a/regression/jvm/SynchronizationTest.java
+++ b/regression/jvm/SynchronizationTest.java
@@ -36,8 +36,64 @@ public class SynchronizationTest extends TestCase {
}
}
+ public static synchronized int staticSynchronizedMethod(int x) {
+ return x;
+ }
+
+ public synchronized int synchronizedMethod(int x) {
+ return x;
+ }
+
+ public static synchronized void staticSynchronizedExceptingMethod() {
+ throw new RuntimeException();
+ }
+
+ public synchronized void synchronizedExceptingMethod() {
+ throw new RuntimeException();
+ }
+
+ public static void testSynchronizedExceptingMethod() {
+ SynchronizationTest test = new SynchronizationTest();
+ boolean caught = false;
+
+ try {
+ test.synchronizedExceptingMethod();
+ } catch (RuntimeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testSynchronizedMethod() {
+ SynchronizationTest test = new SynchronizationTest();
+
+ assertEquals(3, test.synchronizedMethod(3));
+ }
+
+ public static void testStaticSynchronizedExceptingMethod() {
+ boolean caught = false;
+
+ try {
+ staticSynchronizedExceptingMethod();
+ } catch (RuntimeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testStaticSynchronizedMethod() {
+ assertEquals(3, staticSynchronizedMethod(3));
+ }
+
+
public static void main(String[] args) {
testMonitorEnterAndExit();
+ testStaticSynchronizedMethod();
+ testSynchronizedMethod();
+ testStaticSynchronizedExceptingMethod();
+ testSynchronizedExceptingMethod();
exit();
}
--
1.6.0.6
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel