#1213 - NPE with TxType SUPPORTS

This commit is contained in:
Rob Bygrave committed 2017-11-19 01:51:03 +13:00
1 parent fcff571664
commit f0ddf6c7e6
2 files changed
+28 -1

No files matched your search

@@ -8,7 +8,9 @@ import io.ebean.annotation.TxType;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tests.model.basic.EBasic;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -40,6 +42,13 @@ public class TestTransactionalSupports extends BaseTestCase {
}
}
@Test
public void supports_withInternalSave() {
int got = new SomeTransactionalWithSupportsAndSave().doStuff();
assertThat(got).isEqualTo(42);
}
class SomeTransactionalWithSupports {
@Transactional(type = TxType.SUPPORTS)
@@ -50,4 +59,18 @@ public class TestTransactionalSupports extends BaseTestCase {
}
class SomeTransactionalWithSupportsAndSave {
@Transactional(type = TxType.SUPPORTS)
int doStuff() {
EBasic basic = new EBasic();
basic.setName("checkSupports");
// effective creates a transaction replacing the 'No active transaction' placeholder
Ebean.save(basic);
return 42;
}
}
}