Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Oct 10, 2025

What changes were proposed in this pull request?

This PR aims to revisit JUnit assertion usage in test cases after upgrading to JUnit 6.

Why are the changes needed?

There are three cases:

  1. Fix wrong usage of assertEquals: The first parameter is the expected value.
- assertEquals(previousGeneration2, 1L);
+ assertEquals(1L, previousGeneration2);
  1. assertNull is better than assertEquals(null, *).
- assertEquals(null, spec1.runtimeVersions.jdkVersion);
- assertEquals(null, spec1.runtimeVersions.scalaVersion);
- assertEquals(null, spec1.runtimeVersions.sparkVersion);
+ assertNull(spec1.runtimeVersions.jdkVersion);
+ assertNull(spec1.runtimeVersions.scalaVersion);
+ assertNull(spec1.runtimeVersions.sparkVersion);
  1. assertInstanceOf is more intuitive than assertTrue(... instanceof ...).
- assertTrue(constructorArgs.get(conf).get(0) instanceof SparkConf);
+ assertInstanceOf(SparkConf.class, constructorArgs.get(conf).get(0));

Does this PR introduce any user-facing change?

No. This is a test case fix and improvement.

How was this patch tested?

Pass the CIs.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun
Copy link
Member Author

Thank you, @viirya ! Merged to main.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-53872 branch October 10, 2025 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants