Commit 41083907 authored by Ivo Anjo's avatar Ivo Anjo

Added some more testcases to TransactionTest1

parent fcc13917
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
package javartm.tests; package javartm.tests;
import javartm.AtomicRunnable;
import javartm.Transaction; import javartm.Transaction;
import javartm.Warmup;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -51,8 +53,24 @@ public class TransactionTest1 { ...@@ -51,8 +53,24 @@ public class TransactionTest1 {
if (Transaction.begin() == Transaction.STARTED) { if (Transaction.begin() == Transaction.STARTED) {
inTransaction = Transaction.inTransaction(); inTransaction = Transaction.inTransaction();
Transaction.commit(); Transaction.commit();
Assert.assertTrue(inTransaction);
} else {
Assert.assertFalse(inTransaction);
} }
Assert.assertTrue(inTransaction); Assert.assertFalse(Transaction.inTransaction());
}
@Test
public void testDoTransactionally() {
AtomicRunnable<Boolean> transaction = new AtomicRunnable<Boolean>() {
@Override
public Boolean run() {
return true;
}
};
Warmup.doWarmup(transaction);
Boolean result = Transaction.doTransactionally(transaction);
Assert.assertTrue(result);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment