mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor move tests from ebean-core to ebean-test
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package org.tests.basic;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.tests.model.basic.PersistentFile;
|
||||
import org.tests.model.basic.PersistentFileContent;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
public class TestDeleteOneToOne extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testCreateDeletePersistentFile() {
|
||||
|
||||
PersistentFile persistentFile = new PersistentFile("test.txt", new PersistentFileContent(
|
||||
"test".getBytes()));
|
||||
|
||||
DB.save(persistentFile);
|
||||
Integer id = persistentFile.getId();
|
||||
Integer contentId = persistentFile.getPersistentFileContent().getId();
|
||||
|
||||
// should delete file and fileContent
|
||||
DB.delete(PersistentFile.class, id);
|
||||
|
||||
PersistentFile file1 = DB.find(PersistentFile.class, id);
|
||||
PersistentFileContent content1 = DB.find(PersistentFileContent.class, contentId);
|
||||
|
||||
assertNull(file1);
|
||||
assertNull(content1);
|
||||
}
|
||||
|
||||
// public void testDeleteMany() {
|
||||
//
|
||||
// Customer c = new Customer();
|
||||
// c.setName("Fiona");
|
||||
// c.setStatus(Customer.Status.ACTIVE);
|
||||
// c.addContact(new Contact("Fiona", "Black"));
|
||||
// c.addContact(new Contact("Tracy", "Red"));
|
||||
//
|
||||
// DB.save(c);
|
||||
//
|
||||
// DB.delete(Customer.class, c.getId());
|
||||
//
|
||||
// Customer deletedCustomer = DB.find(Customer.class, c.getId());
|
||||
//
|
||||
// assertNull(deletedCustomer);
|
||||
//
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user