mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#919 - io.ebean package initial
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.tests.idkeys;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.tests.model.basic.ECustomId;
|
||||
import org.avaje.moduuid.ModUUID;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestCustomId extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void insert() {
|
||||
|
||||
ECustomId bean = new ECustomId("fred");
|
||||
Ebean.save(bean);
|
||||
assertNotNull(bean.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insert_when_hasValue() {
|
||||
|
||||
ECustomId bean = new ECustomId("gotId");
|
||||
String explicitId = ModUUID.newShortId();
|
||||
bean.setId(explicitId);
|
||||
Ebean.save(bean);
|
||||
|
||||
ECustomId found = Ebean.find(ECustomId.class, explicitId);
|
||||
assertEquals(found.getName(), bean.getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user