Skip to content

Failing unit tests with JDK 18+ #1409

@bdferris-v2

Description

@bdferris-v2

Describe the bug

JDK 18+ are deprecating usage of Security Manager and throwing an exception for any code that attempts to replace the Security Manager per https://bugs.openjdk.org/browse/JDK-8270380. This has an impact on one unit test:

org.mobilitydata.gtfsvalidator.outputcomparator.cli.MainTest

which is using SystemStubs.catchSystemExit() to catch the System.exitcall in the test. Apparently, SystemStubs overrides the security manager.

I think we can fix this pretty easily with a minor refactor of the test.

Steps/Code to Reproduce

./gradlew test when using JDK 18 or greater.

Expected Results

Tests pass without failure.

Actual Results

Tests fail.

Screenshots

No response

Files used

No response

Validator version

N/A

Operating system

MacOS

Java version

openjdk 19.0.2 2023-01-17

Additional notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working (crash, a rule has a problem)status: Needs triageApplied to all new issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions