From 8db1bb4066d3a91cc22d0a3108ba83a4300516dd Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Sat, 30 Sep 2023 11:55:54 +0200 Subject: [PATCH] Update github actions Add JDK 21 to the main build Remove JDK 13 and 18 Add JDK 21 EA --- .github/workflows/java-ea.yml | 2 +- .github/workflows/main.yml | 2 +- parent/pom.xml | 6 ++-- .../jodatime/JodaConversionTest.java | 29 ++++++++++++++++++- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/java-ea.yml b/.github/workflows/java-ea.yml index 3cc488ca7e..a36329ebee 100644 --- a/.github/workflows/java-ea.yml +++ b/.github/workflows/java-ea.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - java: [19-ea] + java: [21-ea] name: 'Linux JDK ${{ matrix.java }}' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54cf0b1076..b27dfc075a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - java: [13, 17, 18] + java: [17, 21] name: 'Linux JDK ${{ matrix.java }}' runs-on: ubuntu-latest steps: diff --git a/parent/pom.xml b/parent/pom.xml index 73239c87e3..ae09b684df 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -25,10 +25,10 @@ 3.0.0-M3 3.0.0-M5 3.1.0 - 5.3.18 + 5.3.30 1.6.0 8.36.1 - 5.8.0-M1 + 5.10.0 1.4.2 1 @@ -576,7 +576,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.10 org.jvnet.jaxb2.maven2 diff --git a/processor/src/test/java/org/mapstruct/ap/test/conversion/jodatime/JodaConversionTest.java b/processor/src/test/java/org/mapstruct/ap/test/conversion/jodatime/JodaConversionTest.java index 1ab73616d5..80feb3bee1 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/conversion/jodatime/JodaConversionTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/conversion/jodatime/JodaConversionTest.java @@ -100,7 +100,7 @@ public void testSourceToTargetMappingForStrings() { } @ProcessorTest - @EnabledForJreRange(min = JRE.JAVA_11) + @EnabledForJreRange(min = JRE.JAVA_11, max = JRE.JAVA_20) // See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+ public void testSourceToTargetMappingForStringsJdk11() { Source src = new Source(); @@ -127,6 +127,33 @@ public void testSourceToTargetMappingForStringsJdk11() { assertThat( target.getLocalTime() ).isEqualTo( "00:00:00" ); } + @ProcessorTest + @EnabledForJreRange(min = JRE.JAVA_21) + public void testSourceToTargetMappingForStringsJdk21() { + Source src = new Source(); + src.setLocalTime( new LocalTime( 0, 0 ) ); + src.setLocalDate( new LocalDate( 2014, 1, 1 ) ); + src.setLocalDateTime( new LocalDateTime( 2014, 1, 1, 0, 0 ) ); + src.setDateTime( new DateTime( 2014, 1, 1, 0, 0, 0, DateTimeZone.UTC ) ); + + // with given format + Target target = SourceTargetMapper.INSTANCE.sourceToTarget( src ); + + assertThat( target ).isNotNull(); + assertThat( target.getDateTime() ).isEqualTo( "01.01.2014 00:00 UTC" ); + assertThat( target.getLocalDateTime() ).isEqualTo( "01.01.2014 00:00" ); + assertThat( target.getLocalDate() ).isEqualTo( "01.01.2014" ); + assertThat( target.getLocalTime() ).isEqualTo( "00:00" ); + + // and now with default mappings + target = SourceTargetMapper.INSTANCE.sourceToTargetDefaultMapping( src ); + assertThat( target ).isNotNull(); + assertThat( target.getDateTime() ).isEqualTo( "1. Januar 2014, 00:00:00 UTC" ); + assertThat( target.getLocalDateTime() ).isEqualTo( "1. Januar 2014, 00:00:00" ); + assertThat( target.getLocalDate() ).isEqualTo( "1. Januar 2014" ); + assertThat( target.getLocalTime() ).isEqualTo( "00:00:00" ); + } + @ProcessorTest public void testStringToDateTime() { String dateTimeAsString = "01.01.2014 00:00 UTC";