mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#686 - Trouble with non-standard java.sql.Date values caching in 7.8.1.
This commit is contained in:
+6
@@ -10,6 +10,8 @@ import com.avaje.tests.model.basic.Car;
|
||||
import com.avaje.tests.model.basic.Customer;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class CachedBeanDataFromBeanTest extends BaseTestCase {
|
||||
@@ -21,9 +23,12 @@ public class CachedBeanDataFromBeanTest extends BaseTestCase {
|
||||
|
||||
BeanDescriptor<Customer> desc = server.getBeanDescriptor(Customer.class);
|
||||
|
||||
Date largeDate = new Date(9223372036825200000L);
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(42);
|
||||
customer.setName("Rob");
|
||||
customer.setAnniversary(largeDate);
|
||||
|
||||
Address billingAddress = new Address();
|
||||
billingAddress.setId(Short.valueOf("12"));
|
||||
@@ -36,6 +41,7 @@ public class CachedBeanDataFromBeanTest extends BaseTestCase {
|
||||
assertEquals(cacheData.getData("id"), "42");
|
||||
assertEquals(cacheData.getData("name"), "Rob");
|
||||
assertEquals(cacheData.getData("billingAddress"), "12");
|
||||
assertEquals(cacheData.getData("anniversary"), "9223372036825200000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ScalarTypeDateTest {
|
||||
|
||||
ScalarTypeDate type = new ScalarTypeDate();
|
||||
|
||||
@Test
|
||||
public void formatParse_PG_DATE_POSITIVE_INFINITY() {
|
||||
|
||||
Date postgresInfinityDate = new Date(9223372036825200000L);
|
||||
|
||||
String format = type.formatValue(postgresInfinityDate);
|
||||
Date parsed = type.parse(format);
|
||||
assertEquals(parsed, postgresInfinityDate);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user