mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
33 lines
619 B
Java
33 lines
619 B
Java
package com.avaje.tests.transaction;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
|
|
import com.avaje.ebean.BaseTestCase;
|
|
import com.avaje.ebean.Ebean;
|
|
import com.avaje.ebean.TxRunnable;
|
|
|
|
public class TestNested extends BaseTestCase {
|
|
|
|
@Test
|
|
public void test() {
|
|
|
|
try {
|
|
Ebean.execute(() -> willFail());
|
|
} catch (RuntimeException e) {
|
|
Assert.assertEquals(e.getMessage(), "test rollback");
|
|
}
|
|
}
|
|
|
|
private void willFail() {
|
|
Ebean.execute(new TxRunnable() {
|
|
public void run() {
|
|
|
|
String msg = "test rollback";
|
|
throw new RuntimeException(msg);
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|