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,46 @@
|
||||
package org.tests.m2m;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.SqlRow;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.m2m.MnyA;
|
||||
import org.tests.model.m2m.MnyB;
|
||||
import org.tests.model.m2m.MnyC;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class TestM2MDeleteCascadeFromParent extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
DB.sqlUpdate("delete from mny_b_mny_c").execute();
|
||||
DB.sqlUpdate("delete from mny_c").execute();
|
||||
DB.sqlUpdate("delete from mny_b").execute();
|
||||
DB.sqlUpdate("delete from mny_a").execute();
|
||||
|
||||
MnyC c0 = new MnyC();
|
||||
c0.setName("c0");
|
||||
c0.save();
|
||||
|
||||
MnyA a0 = new MnyA();
|
||||
a0.setName("a0");
|
||||
a0.save();
|
||||
|
||||
MnyB b0 = new MnyB();
|
||||
b0.setName("b0");
|
||||
b0.setA(a0);
|
||||
b0.save();
|
||||
|
||||
c0.getBs().add(b0);
|
||||
DB.save(c0);
|
||||
|
||||
SqlRow row = DB.sqlQuery("select count(*) as count from mny_b_mny_c").findOne();
|
||||
assertEquals(Long.valueOf(1), row.getLong("count"));
|
||||
|
||||
a0.delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user