|
|
|
|
@ -17,7 +17,11 @@ package org.springframework.data.jdbc.core.dialect;
@@ -17,7 +17,11 @@ package org.springframework.data.jdbc.core.dialect;
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.*; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
import org.postgresql.geometric.PGbox; |
|
|
|
|
import org.postgresql.geometric.PGcircle; |
|
|
|
|
import org.postgresql.geometric.PGlseg; |
|
|
|
|
@ -26,28 +30,39 @@ import org.postgresql.geometric.PGpoint;
@@ -26,28 +30,39 @@ import org.postgresql.geometric.PGpoint;
|
|
|
|
|
import org.postgresql.geometric.PGpolygon; |
|
|
|
|
import org.postgresql.util.PGobject; |
|
|
|
|
|
|
|
|
|
import org.springframework.data.jdbc.core.convert.JdbcCustomConversions; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Unit tests for {@link JdbcPostgresDialect}. |
|
|
|
|
* |
|
|
|
|
* @author Jens Schauder |
|
|
|
|
* @author Mark Paluch |
|
|
|
|
*/ |
|
|
|
|
public class JdbcPostgresDialectUnitTests { |
|
|
|
|
class JdbcPostgresDialectUnitTests { |
|
|
|
|
|
|
|
|
|
@Test // GH-1065
|
|
|
|
|
void pgobjectIsConsideredSimple() { |
|
|
|
|
assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains(PGobject.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // GH-1065
|
|
|
|
|
void geometricalTypesAreConsideredSimple() { |
|
|
|
|
@ParameterizedTest // GH-1065, GH-2147
|
|
|
|
|
@MethodSource("simpleTypes") |
|
|
|
|
void simpleTypesAreConsideredSimple(Class<?> type) { |
|
|
|
|
|
|
|
|
|
JdbcCustomConversions conversions = JdbcCustomConversions.of(JdbcPostgresDialect.INSTANCE, List.of()); |
|
|
|
|
|
|
|
|
|
assertThat(conversions.isSimpleType(type)).isTrue(); |
|
|
|
|
assertThat(conversions.getSimpleTypeHolder().isSimpleType(type)).isTrue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains( //
|
|
|
|
|
PGpoint.class, //
|
|
|
|
|
static List<Class<?>> simpleTypes() { |
|
|
|
|
return List.of(PGpoint.class, //
|
|
|
|
|
PGbox.class, //
|
|
|
|
|
PGcircle.class, //
|
|
|
|
|
org.postgresql.geometric.PGline.class, //
|
|
|
|
|
PGpath.class, //
|
|
|
|
|
PGpolygon.class, //
|
|
|
|
|
PGlseg.class); |
|
|
|
|
PGlseg.class, //
|
|
|
|
|
PGobject.class); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|