forked from ebean-orm/ebean-orm.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomerTest.java
More file actions
39 lines (27 loc) · 799 Bytes
/
CustomerTest.java
File metadata and controls
39 lines (27 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import io.ebean.DB;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class CustomerTest {
@Test
public void insertFindDelete() {
Customer customer = new Customer("Rob");
customer.save();
// find using an expression query
final Customer rob =
DB.find(Customer.class)
.where().istartsWith("name", "ro")
.findOne();
assertNotNull(rob);
// IDE Re-build to generate the QCustomer query bean
// // find using a query bean
// final Customer rob2 = new QCustomer()
// .name.istartsWith("ro")
// .findOne();
//
// assertNotNull(rob);
rob.delete();
final Customer notThere = DB.find(Customer.class, customer.getId());
assertNull(notThere);
}
}