Skip to content

Commit f08fd53

Browse files
committed
Fix TimeZoneByNameMappingTest for Java 24+
1 parent b572aef commit f08fd53

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
@@ -380,6 +380,13 @@ public static void defaultDatabaseTearDown(FBManager fbManager) throws Exception
380380
}
381381
}
382382

383+
/**
384+
* @return the Java major/feature version (as defined in {@code java.lang.Runtime.Version} in Java 10 and higher)
385+
*/
386+
public static int getJavaFeatureVersion() {
387+
return Runtime.version().feature();
388+
}
389+
383390
private FBTestProperties() {
384391
// No instantiation
385392
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.firebirdsql.gds.ng.tz;
2020

21+
import org.firebirdsql.common.FBTestProperties;
2122
import org.junit.jupiter.params.ParameterizedTest;
2223
import org.junit.jupiter.params.provider.Arguments;
2324
import org.junit.jupiter.params.provider.MethodSource;
@@ -51,6 +52,7 @@ void mapsJavaZoneIdToFirebirdId(int firebirdZoneId, String zoneName, String jtZo
5152
}
5253

5354
static Stream<Arguments> getTestCases() {
55+
final int javaVersion = FBTestProperties.getJavaFeatureVersion();
5456
return Stream.of(
5557
testCase(65535, "GMT"),
5658
testCase(65534, "ACT", "Australia/Darwin", 65180),
@@ -451,7 +453,8 @@ static Stream<Arguments> getTestCases() {
451453
testCase(65139, "EAT", "Africa/Addis_Ababa", 65527),
452454
testCase(65138, "ECT", "Europe/Paris", 65061),
453455
testCase(65137, "EET"),
454-
testCase(65136, "EST", "-05:00", 1139),
456+
javaVersion < 24 ? testCase(65136, "EST", "-05:00", 1139)
457+
: testCase(65136, "EST", "America/Panama", 65353),
455458
testCase(65135, "EST5EDT"),
456459
testCase(65134, "Egypt"),
457460
testCase(65133, "Eire"),
@@ -560,7 +563,8 @@ static Stream<Arguments> getTestCases() {
560563
testCase(65030, "GMT-0", "GMT", 65535),
561564
testCase(65029, "GMT0"),
562565
testCase(65028, "Greenwich"),
563-
testCase(65027, "HST", "-10:00", 839),
566+
javaVersion < 24 ? testCase(65027, "HST", "-10:00", 839)
567+
: testCase(65027, "HST", "Pacific/Honolulu", 64971),
564568
testCase(65026, "Hongkong"),
565569
testCase(65025, "IET", "America/Indiana/Indianapolis", 65403),
566570
testCase(65024, "IST", "Asia/Kolkata", 65248),
@@ -585,7 +589,8 @@ static Stream<Arguments> getTestCases() {
585589
testCase(65005, "Libya"),
586590
testCase(65004, "MET"),
587591
testCase(65003, "MIT", "Pacific/Apia", 64986),
588-
testCase(65002, "MST", "-07:00", 1019),
592+
javaVersion < 24 ? testCase(65002, "MST", "-07:00", 1019)
593+
: testCase(65002, "MST", "America/Phoenix", 65350),
589594
testCase(65001, "MST7MDT"),
590595
testCase(65000, "Mexico/BajaNorte"),
591596
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
@@ -19,6 +19,7 @@
1919
package org.firebirdsql.jdbc;
2020

2121
import org.firebirdsql.common.DdlHelper;
22+
import org.firebirdsql.common.FBTestProperties;
2223
import org.firebirdsql.common.extension.UsesDatabaseExtension;
2324
import org.junit.jupiter.api.AfterAll;
2425
import org.junit.jupiter.api.BeforeAll;
@@ -798,7 +799,7 @@ void testGetJDBCMajorVersion() throws Exception {
798799

799800
@Test
800801
void testGetJDBCMinorVersion() throws Exception {
801-
final int expectedMinor = Runtime.version().compareTo(Runtime.Version.parse("24")) >= 0 ? 4 : 3;
802+
final int expectedMinor = FBTestProperties.getJavaFeatureVersion() >= 24 ? 4 : 3;
802803
assertEquals(expectedMinor, dmd.getJDBCMinorVersion(), "JDBCMinorVersion");
803804
}
804805

0 commit comments

Comments
 (0)