#2737 - Mapping of TimeZone doesn't have enough characters

This commit is contained in:
Rob Bygrave
2022-07-05 09:05:13 +12:00
parent 283e0b66fa
commit 745fbe883e
3 changed files with 35 additions and 2 deletions
@@ -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();