#700 - Postgres ARRAY and JSON expressions cast Long to ::integer rather than ::bigint

This commit is contained in:
Robin Bygrave
2016-05-12 17:22:40 +12:00
parent ad3b9b2f84
commit 1d8bb8c800
2 changed files with 34 additions and 17 deletions
@@ -0,0 +1,28 @@
package com.avaje.ebeaninternal.server.core;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class PostgresCastTest {
@Test
public void cast() throws Exception {
assertThat(PostgresCast.cast(1)).isEqualTo("::integer");
assertThat(PostgresCast.cast(1L)).isEqualTo("::bigint");
assertThat(PostgresCast.cast(1.0D)).isEqualTo("::decimal");
assertThat(PostgresCast.cast("")).isEqualTo("");
}
@Test
public void cast1() throws Exception {
assertThat(PostgresCast.cast(1, true)).isEqualTo("::integer[]");
assertThat(PostgresCast.cast(1L, true)).isEqualTo("::bigint[]");
assertThat(PostgresCast.cast(1.0D, true)).isEqualTo("::decimal[]");
assertThat(PostgresCast.cast("", true)).isEqualTo("");
}
}