#507 - PropertiesWrapper support null enum values with getEnum()

This commit is contained in:
Robin Bygrave
2015-12-24 15:23:25 +13:00
parent a2a301beda
commit 03a9aa3dec
2 changed files with 15 additions and 2 deletions
@@ -1,5 +1,6 @@
package com.avaje.ebean.config;
import com.avaje.ebean.config.dbplatform.DbPlatformName;
import org.junit.Test;
import java.util.Properties;
@@ -17,6 +18,18 @@ public class PropertiesWrapperTest {
assertEquals("myserver", pw.getServerName());
}
@Test
public void testGetEnum() {
Properties properties = new Properties();
properties.put("platform","postgres");
PropertiesWrapper pw = new PropertiesWrapper("pref", "myserver", properties);
assertEquals(DbPlatformName.POSTGRES, pw.getEnum(DbPlatformName.class, "platform", DbPlatformName.H2));
assertEquals(DbPlatformName.H2, pw.getEnum(DbPlatformName.class, "junk", DbPlatformName.H2));
assertNull(pw.getEnum(DbPlatformName.class, "junk", null));
}
@Test
public void testTrimPropertyValues() {