Skip to content

Commit bee7256

Browse files
committed
Fix TimeZoneByNameMappingTest for Java 24+
1 parent 3a0fa81 commit bee7256

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/test/org/firebirdsql/common/FBTestProperties.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ public static void defaultDatabaseTearDown(FBManager fbManager) throws Exception
370370
}
371371
}
372372

373+
/**
374+
* @return the Java major/feature version (as defined in {@code java.lang.Runtime.Version} in Java 10 and higher)
375+
*/
376+
public static int getJavaFeatureVersion() {
377+
return Runtime.version().feature();
378+
}
379+
373380
/**
374381
* If schema support is available, returns {@code forSchema}, otherwise returns {@code withoutSchema}.
375382
*

src/test/org/firebirdsql/gds/ng/tz/TimeZoneByNameMappingTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: LGPL-2.1-or-later
33
package org.firebirdsql.gds.ng.tz;
44

5+
import org.firebirdsql.common.FBTestProperties;
56
import org.junit.jupiter.params.ParameterizedTest;
67
import org.junit.jupiter.params.provider.Arguments;
78
import org.junit.jupiter.params.provider.MethodSource;
@@ -35,6 +36,7 @@ void mapsJavaZoneIdToFirebirdId(int firebirdZoneId, String zoneName, String jtZo
3536
}
3637

3738
static Stream<Arguments> getTestCases() {
39+
final int javaVersion = FBTestProperties.getJavaFeatureVersion();
3840
return Stream.of(
3941
testCase(65535, "GMT"),
4042
testCase(65534, "ACT", "Australia/Darwin", 65180),
@@ -435,7 +437,8 @@ static Stream<Arguments> getTestCases() {
435437
testCase(65139, "EAT", "Africa/Addis_Ababa", 65527),
436438
testCase(65138, "ECT", "Europe/Paris", 65061),
437439
testCase(65137, "EET"),
438-
testCase(65136, "EST", "-05:00", 1139),
440+
javaVersion < 24 ? testCase(65136, "EST", "-05:00", 1139)
441+
: testCase(65136, "EST", "America/Panama", 65353),
439442
testCase(65135, "EST5EDT"),
440443
testCase(65134, "Egypt"),
441444
testCase(65133, "Eire"),
@@ -544,7 +547,8 @@ static Stream<Arguments> getTestCases() {
544547
testCase(65030, "GMT-0", "GMT", 65535),
545548
testCase(65029, "GMT0"),
546549
testCase(65028, "Greenwich"),
547-
testCase(65027, "HST", "-10:00", 839),
550+
javaVersion < 24 ? testCase(65027, "HST", "-10:00", 839)
551+
: testCase(65027, "HST", "Pacific/Honolulu", 64971),
548552
testCase(65026, "Hongkong"),
549553
testCase(65025, "IET", "America/Indiana/Indianapolis", 65403),
550554
testCase(65024, "IST", "Asia/Kolkata", 65248),
@@ -569,7 +573,8 @@ static Stream<Arguments> getTestCases() {
569573
testCase(65005, "Libya"),
570574
testCase(65004, "MET"),
571575
testCase(65003, "MIT", "Pacific/Apia", 64986),
572-
testCase(65002, "MST", "-07:00", 1019),
576+
javaVersion < 24 ? testCase(65002, "MST", "-07:00", 1019)
577+
: testCase(65002, "MST", "America/Phoenix", 65350),
573578
testCase(65001, "MST7MDT"),
574579
testCase(65000, "Mexico/BajaNorte"),
575580
testCase(64999, "Mexico/BajaSur"),

src/test/org/firebirdsql/jdbc/FBDatabaseMetaDataTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package org.firebirdsql.jdbc;
99

1010
import org.firebirdsql.common.DdlHelper;
11+
import org.firebirdsql.common.FBTestProperties;
1112
import org.firebirdsql.common.extension.UsesDatabaseExtension;
1213
import org.firebirdsql.util.FirebirdSupportInfo;
1314
import org.junit.jupiter.api.AfterAll;
@@ -759,7 +760,7 @@ void testGetJDBCMajorVersion() throws Exception {
759760

760761
@Test
761762
void testGetJDBCMinorVersion() throws Exception {
762-
final int expectedMinor = Runtime.version().compareTo(Runtime.Version.parse("24")) >= 0 ? 4 : 3;
763+
final int expectedMinor = FBTestProperties.getJavaFeatureVersion() >= 24 ? 4 : 3;
763764
assertEquals(expectedMinor, dmd.getJDBCMinorVersion(), "JDBCMinorVersion");
764765
}
765766

0 commit comments

Comments
 (0)