mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2737 - Mapping of TimeZone doesn't have enough characters
This commit is contained in:
@@ -13,7 +13,7 @@ final class ScalarTypeTimeZone extends ScalarTypeBaseVarchar<TimeZone> {
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return 20;
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class ScalarTypeTimeZoneTest {
|
||||
|
||||
ScalarTypeTimeZone type = new ScalarTypeTimeZone();
|
||||
|
||||
@Test
|
||||
void getLength() {
|
||||
assertEquals(32, type.getLength());
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,26 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
class TestExtraScalarTypes extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
void insertLargeTimezone() {
|
||||
TimeZone tz = TimeZone.getTimeZone("America/Argentina/ComodRivadavia");
|
||||
var bean = new ESomeType();
|
||||
bean.setTimeZone(tz);
|
||||
DB.save(bean);
|
||||
|
||||
var found = DB.find(ESomeType.class, bean.getId());
|
||||
assert found != null;
|
||||
assertThat(found.getTimeZone()).isEqualTo(tz);
|
||||
|
||||
var findByTimezone = DB.find(ESomeType.class).where().eq("timeZone", tz).findList();
|
||||
assertThat(findByTimezone).hasSize(1);
|
||||
assertThat(findByTimezone.get(0).getId()).isEqualTo(found.getId());
|
||||
assertThat(findByTimezone.get(0).getTimeZone()).isEqualTo(tz);
|
||||
|
||||
DB.delete(found);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
Locale locale = Locale.ENGLISH;
|
||||
Currency currency = Currency.getInstance(Locale.US);
|
||||
TimeZone tz = TimeZone.getDefault();
|
||||
|
||||
Reference in New Issue
Block a user