Use JUnit 5 in all lighty project and remove TestNG.#2598
Use JUnit 5 in all lighty project and remove TestNG.#2598Tobianas wants to merge 6 commits intoPANTHEONtech:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request migrates the lighty project from TestNG to JUnit 5 for unit testing. This involves removing TestNG dependencies, adding JUnit 5 dependencies, and updating assertion and test lifecycle annotations in the test code. The goal is to modernize the testing framework and leverage the features offered by JUnit 5. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request provides a comprehensive migration from TestNG to JUnit 5 across the project. The changes are extensive and well-executed, covering dependency updates, annotation changes, and assertion migrations. I've added a few suggestions for improving test readability and correctness, such as using more specific assertions (assertFalse, assertArrayEquals) and addressing a minor logical flaw in one of the tests. Overall, this is a great step towards modernizing the test suite.
lighty-core/lighty-controller/src/test/java/io/lighty/core/controller/api/LightyModuleTest.java
Outdated
Show resolved
Hide resolved
...core/lighty-common/src/test/java/io/lighty/core/common/models/tests/YangModelUtilsTests.java
Outdated
Show resolved
Hide resolved
...core/lighty-common/src/test/java/io/lighty/core/common/models/tests/YangModelUtilsTests.java
Outdated
Show resolved
Hide resolved
lighty-core/lighty-controller/src/test/java/io/lighty/core/controller/api/LightyModuleTest.java
Outdated
Show resolved
Hide resolved
...re/lighty-controller/src/test/java/io/lighty/core/controller/api/SystemReadyMonitorTest.java
Show resolved
Hide resolved
...core/lighty-controller/src/test/java/io/lighty/core/controller/config/ConfigLoadingTest.java
Outdated
Show resolved
Hide resolved
...ty-core/lighty-controller/src/test/java/io/lighty/core/controller/datainit/DataInitTest.java
Outdated
Show resolved
Hide resolved
093df73 to
8f22444
Compare
Unify all the lighty tests to depend on junit.jupiter only. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
911e219 to
274184c
Compare
...ghty-controller/src/test/java/io/lighty/core/controller/impl/tests/LightyControllerTest.java
Show resolved
Hide resolved
lighty-core/lighty-controller/src/test/java/io/lighty/core/controller/impl/tests/TestUtils.java
Outdated
Show resolved
Hide resolved
...tion-tests/src/test/java/io/lighty/modules/southbound/netconf/tests/TopologyPluginsTest.java
Outdated
Show resolved
Hide resolved
...a-aggregator/lighty-aaa/src/test/java/io/lighty/aaa/config/CertificateManagerConfigTest.java
Outdated
Show resolved
Hide resolved
...a-aggregator/lighty-aaa/src/test/java/io/lighty/aaa/config/CertificateManagerConfigTest.java
Outdated
Show resolved
Hide resolved
...es/lighty-aaa-aggregator/lighty-aaa/src/test/java/io/lighty/aaa/ShiroInitializationTest.java
Outdated
Show resolved
Hide resolved
lighty-modules/lighty-openapi/src/test/java/io/lighty/openapi/OpenApiLightyTestBase.java
Outdated
Show resolved
Hide resolved
...core/lighty-common/src/test/java/io/lighty/core/common/models/tests/YangModelUtilsTests.java
Show resolved
Hide resolved
lighty-core/lighty-common/src/test/java/io/lighty/core/common/SocketAnalyzerTest.java
Outdated
Show resolved
Hide resolved
Replace testng dependencies with junit-jupiter to unify the test framework for the entire project. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
With the migration from TestNG to JUnit 5, TestNG suite XML files are no longer supported or required for test discovery. JUnit 5 automatically scans and discovers tests on the classpath. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
274184c to
bc8385f
Compare
Replace all testng and plain junit with junit.jupiter throughout the entire lighty.io project. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
The assertion assertTrue(moduleId.hashCode() == other.hashCode() == expectedResult) is logically flawed. It incorrectly asserts that unequal objects must have different hash codes, which is not guaranteed by the hashCode() contract. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
These tests do not need to be public for JUnit 5. JIRA: LIGHTY-409 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
bc8385f to
8a64f24
Compare
No description provided.