|
17 | 17 |
|
18 | 18 | import static org.assertj.core.api.Assertions.*; |
19 | 19 |
|
| 20 | +import java.util.List; |
| 21 | + |
20 | 22 | import org.junit.jupiter.api.Test; |
| 23 | +import org.junit.jupiter.params.ParameterizedTest; |
| 24 | +import org.junit.jupiter.params.provider.MethodSource; |
21 | 25 | import org.postgresql.geometric.PGbox; |
22 | 26 | import org.postgresql.geometric.PGcircle; |
23 | 27 | import org.postgresql.geometric.PGlseg; |
|
26 | 30 | import org.postgresql.geometric.PGpolygon; |
27 | 31 | import org.postgresql.util.PGobject; |
28 | 32 |
|
| 33 | +import org.springframework.data.jdbc.core.convert.JdbcCustomConversions; |
| 34 | + |
29 | 35 | /** |
30 | 36 | * Unit tests for {@link JdbcPostgresDialect}. |
31 | 37 | * |
32 | 38 | * @author Jens Schauder |
| 39 | + * @author Mark Paluch |
33 | 40 | */ |
34 | | -public class JdbcPostgresDialectUnitTests { |
| 41 | +class JdbcPostgresDialectUnitTests { |
35 | 42 |
|
36 | 43 | @Test // GH-1065 |
37 | 44 | void pgobjectIsConsideredSimple() { |
38 | 45 | assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains(PGobject.class); |
39 | 46 | } |
40 | 47 |
|
41 | | - @Test // GH-1065 |
42 | | - void geometricalTypesAreConsideredSimple() { |
| 48 | + @ParameterizedTest // GH-1065, GH-2147 |
| 49 | + @MethodSource("simpleTypes") |
| 50 | + void simpleTypesAreConsideredSimple(Class<?> type) { |
| 51 | + |
| 52 | + JdbcCustomConversions conversions = JdbcCustomConversions.of(JdbcPostgresDialect.INSTANCE, List.of()); |
| 53 | + |
| 54 | + assertThat(conversions.isSimpleType(type)).isTrue(); |
| 55 | + assertThat(conversions.getSimpleTypeHolder().isSimpleType(type)).isTrue(); |
| 56 | + } |
43 | 57 |
|
44 | | - assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains( // |
45 | | - PGpoint.class, // |
| 58 | + static List<Class<?>> simpleTypes() { |
| 59 | + return List.of(PGpoint.class, // |
46 | 60 | PGbox.class, // |
47 | 61 | PGcircle.class, // |
48 | 62 | org.postgresql.geometric.PGline.class, // |
49 | 63 | PGpath.class, // |
50 | 64 | PGpolygon.class, // |
51 | | - PGlseg.class); |
| 65 | + PGlseg.class, // |
| 66 | + PGobject.class); |
52 | 67 | } |
53 | 68 | } |
0 commit comments