From a6e79ff6db7d52d38e67f8d6ccc78cb223d0bea4 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 19 Sep 2022 09:10:22 +0300 Subject: [PATCH] Relax testing constraints on certain dates tests These tests are not taking timezones properly into account, but they also don't really need to fully test the date handling, so we relax them a bit. Closes: #28035 --- .../it/hibernate/orm/rest/data/panache/Author.java | 7 +------ .../it/jackson/DateDeserializerPojoResourceTest.java | 3 ++- .../java/io/quarkus/it/spring/data/rest/Author.java | 11 +++-------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/integration-tests/hibernate-orm-rest-data-panache/src/main/java/io/quarkus/it/hibernate/orm/rest/data/panache/Author.java b/integration-tests/hibernate-orm-rest-data-panache/src/main/java/io/quarkus/it/hibernate/orm/rest/data/panache/Author.java index 20e26b1d1aee1..659d87e9b5edf 100644 --- a/integration-tests/hibernate-orm-rest-data-panache/src/main/java/io/quarkus/it/hibernate/orm/rest/data/panache/Author.java +++ b/integration-tests/hibernate-orm-rest-data-panache/src/main/java/io/quarkus/it/hibernate/orm/rest/data/panache/Author.java @@ -1,11 +1,7 @@ package io.quarkus.it.hibernate.orm.rest.data.panache; -import java.time.LocalDate; - import javax.persistence.Entity; -import com.fasterxml.jackson.annotation.JsonFormat; - import io.quarkus.hibernate.orm.panache.PanacheEntity; @Entity @@ -13,6 +9,5 @@ public class Author extends PanacheEntity { public String name; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - public LocalDate dob; + public String dob; } diff --git a/integration-tests/jackson/src/test/java/io/quarkus/it/jackson/DateDeserializerPojoResourceTest.java b/integration-tests/jackson/src/test/java/io/quarkus/it/jackson/DateDeserializerPojoResourceTest.java index 0399f419a88cb..5ead6ca1f17dd 100644 --- a/integration-tests/jackson/src/test/java/io/quarkus/it/jackson/DateDeserializerPojoResourceTest.java +++ b/integration-tests/jackson/src/test/java/io/quarkus/it/jackson/DateDeserializerPojoResourceTest.java @@ -3,6 +3,7 @@ import static io.quarkus.it.jackson.TestUtil.getObjectMapperForTest; import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.startsWith; import java.io.IOException; import java.sql.Date; @@ -38,6 +39,6 @@ public void testSqlDate() throws IOException { .when().post("/datedeserializers/sql/date") .then() .statusCode(200) - .body("date", equalTo("1970-01-01")); + .body("date", startsWith("1970-")); } } diff --git a/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/Author.java b/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/Author.java index 502258388bce8..92074821e8b0f 100644 --- a/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/Author.java +++ b/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/Author.java @@ -1,13 +1,9 @@ package io.quarkus.it.spring.data.rest; -import java.time.LocalDate; - import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import com.fasterxml.jackson.annotation.JsonFormat; - @Entity public class Author { @@ -17,8 +13,7 @@ public class Author { private String name; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate dob; + private String dob; public Long getId() { return id; @@ -32,11 +27,11 @@ public void setName(String name) { this.name = name; } - public LocalDate getDob() { + public String getDob() { return dob; } - public void setDob(LocalDate dob) { + public void setDob(String dob) { this.dob = dob; } }