mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Refactor move tests from ebean-core to ebean-test
This commit is contained in:
1 parent
0b00a14fd3
commit
eab56d323b
1650 files changed
+185
-147
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package org.tests.transaction;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.Transactional;
|
||||
import io.ebean.annotation.TxType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestTransactionalNever extends BaseTestCase {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TestTransactionalNever.class);
|
||||
|
||||
private Transaction outerTxn;
|
||||
|
||||
@Test
|
||||
public void testWithNever() {
|
||||
|
||||
new SomeTransactionalWithNever().doStuff();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBarfOnExisting() {
|
||||
assertThrows(PersistenceException.class, this::doWithTransaction);
|
||||
}
|
||||
|
||||
class SomeTransactionalWithNever {
|
||||
|
||||
@Transactional(type = TxType.NEVER)
|
||||
void doStuff() {
|
||||
outerTxn = DB.currentTransaction();
|
||||
log.info("currentTransaction ...{}", outerTxn);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
private void doWithTransaction() {
|
||||
|
||||
// always barf
|
||||
new SomeTransactionalWithNever().doStuff();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user