From 0432fb5068bd24bd98f13cf25a1368b733f720af Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Fri, 29 Sep 2023 15:40:30 +0000 Subject: [PATCH] polish: renames and upgrade to postgres 16 --- ...trollerAdvice.java => GlobalExceptionHandler.java} | 5 ++++- .../java/com/example/jooq/r2dbc/TestApplication.java | 2 +- .../WebRouterConfigIT.java} | 11 +++++------ 3 files changed, 10 insertions(+), 8 deletions(-) rename r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/{ErrorDetailProblemHandlingControllerAdvice.java => GlobalExceptionHandler.java} (92%) rename r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/{ApplicationIntegrationTest.java => router/WebRouterConfigIT.java} (57%) diff --git a/r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/ErrorDetailProblemHandlingControllerAdvice.java b/r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/GlobalExceptionHandler.java similarity index 92% rename from r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/ErrorDetailProblemHandlingControllerAdvice.java rename to r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/GlobalExceptionHandler.java index 6b793f781..b240f3932 100644 --- a/r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/ErrorDetailProblemHandlingControllerAdvice.java +++ b/r2dbc/boot-jooq-r2dbc-sample/src/main/java/com/example/jooq/r2dbc/exception/GlobalExceptionHandler.java @@ -2,6 +2,8 @@ import java.util.List; import java.util.Objects; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode; import org.springframework.http.ProblemDetail; @@ -12,7 +14,8 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ControllerAdvice -public class ErrorDetailProblemHandlingControllerAdvice { +@Order(Ordered.HIGHEST_PRECEDENCE) +public class GlobalExceptionHandler { @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) diff --git a/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/TestApplication.java b/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/TestApplication.java index e474474c4..928564bc4 100644 --- a/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/TestApplication.java +++ b/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/TestApplication.java @@ -13,7 +13,7 @@ public class TestApplication { @Bean @ServiceConnection PostgreSQLContainer postgreSQLContainer() { - return new PostgreSQLContainer<>("postgres:15.3-alpine") + return new PostgreSQLContainer<>("postgres:16.0-alpine") .withCopyFileToContainer( MountableFile.forClasspathResource("init.sql"), "/docker-entrypoint-initdb.d/init.sql"); diff --git a/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/ApplicationIntegrationTest.java b/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/router/WebRouterConfigIT.java similarity index 57% rename from r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/ApplicationIntegrationTest.java rename to r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/router/WebRouterConfigIT.java index 7949c3a77..9181e34df 100644 --- a/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/ApplicationIntegrationTest.java +++ b/r2dbc/boot-jooq-r2dbc-sample/src/test/java/com/example/jooq/r2dbc/router/WebRouterConfigIT.java @@ -1,11 +1,12 @@ -package com.example.jooq.r2dbc; +package com.example.jooq.r2dbc.router; + +import static org.assertj.core.api.Assertions.assertThat; import com.example.jooq.r2dbc.common.AbstractIntegrationTest; import java.util.List; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -class ApplicationIntegrationTest extends AbstractIntegrationTest { +class WebRouterConfigIT extends AbstractIntegrationTest { @Test void willLoadPosts() { @@ -17,8 +18,6 @@ void willLoadPosts() { .is2xxSuccessful() .expectBody() .jsonPath("$[*].title") - .value( - (List titles) -> - Assertions.assertThat(titles).containsAnyOf("jooq test")); + .value((List titles) -> assertThat(titles).containsAnyOf("jooq test")); } }