Skip to content

Commit fa14334

Browse files
committed
Polishing.
Extend tests. See #2147
1 parent 49f4b5f commit fa14334

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/dialect/JdbcPostgresDialectUnitTests.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
import static org.assertj.core.api.Assertions.*;
1919

20+
import java.util.List;
21+
2022
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.params.ParameterizedTest;
24+
import org.junit.jupiter.params.provider.MethodSource;
2125
import org.postgresql.geometric.PGbox;
2226
import org.postgresql.geometric.PGcircle;
2327
import org.postgresql.geometric.PGlseg;
@@ -26,28 +30,39 @@
2630
import org.postgresql.geometric.PGpolygon;
2731
import org.postgresql.util.PGobject;
2832

33+
import org.springframework.data.jdbc.core.convert.JdbcCustomConversions;
34+
2935
/**
3036
* Unit tests for {@link JdbcPostgresDialect}.
3137
*
3238
* @author Jens Schauder
39+
* @author Mark Paluch
3340
*/
34-
public class JdbcPostgresDialectUnitTests {
41+
class JdbcPostgresDialectUnitTests {
3542

3643
@Test // GH-1065
3744
void pgobjectIsConsideredSimple() {
3845
assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains(PGobject.class);
3946
}
4047

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+
}
4357

44-
assertThat(JdbcPostgresDialect.INSTANCE.simpleTypes()).contains( //
45-
PGpoint.class, //
58+
static List<Class<?>> simpleTypes() {
59+
return List.of(PGpoint.class, //
4660
PGbox.class, //
4761
PGcircle.class, //
4862
org.postgresql.geometric.PGline.class, //
4963
PGpath.class, //
5064
PGpolygon.class, //
51-
PGlseg.class);
65+
PGlseg.class, //
66+
PGobject.class);
5267
}
5368
}

0 commit comments

Comments
 (0)