mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1250 - Add explicit coverage for Enum with abstract method - no new issue
This commit is contained in:
@@ -3,6 +3,7 @@ package org.tests.embedded;
|
||||
import io.ebean.Ebean;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.embedded.EAddress;
|
||||
import org.tests.model.embedded.EAddressStatus;
|
||||
import org.tests.model.embedded.EPerson;
|
||||
|
||||
public class TestEmbeddedEmpty {
|
||||
@@ -21,4 +22,15 @@ public class TestEmbeddedEmpty {
|
||||
// treat all embedded properties as loaded
|
||||
person.getAddress().getCity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbstractEnumBinding() {
|
||||
|
||||
EAddressStatus.TWO.doIt();
|
||||
|
||||
Ebean.find(EPerson.class)
|
||||
.where().eq("address.status", EAddressStatus.TWO)
|
||||
.findList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
package org.tests.model.embedded;
|
||||
|
||||
public enum EAddressStatus {
|
||||
ONE,
|
||||
TWO
|
||||
|
||||
ONE("One") {
|
||||
@Override
|
||||
public String doIt() {
|
||||
return 10 + name;
|
||||
}
|
||||
},
|
||||
TWO("Two") {
|
||||
@Override
|
||||
public String doIt() {
|
||||
return 20 + name;
|
||||
}
|
||||
};
|
||||
|
||||
String name;
|
||||
|
||||
EAddressStatus(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public abstract String doIt();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user