Skip to content

Commit 2f9c8ac

Browse files
committed
[SPARK-44242][CORE][FOLLOWUP] Use the assertThrows method to fix Java linter issue
### What changes were proposed in this pull request? Use the `assertThrows` method to test for exceptions. ### Why are the changes needed? Fix Java linter issue. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? N/A. Closes apache#42466 from wangyum/SPARK-44242. Authored-by: Yuming Wang <[email protected]> Signed-off-by: Yuming Wang <[email protected]>
1 parent 295c615 commit 2f9c8ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void testCliHelpAndNoArg() throws Exception {
7272
cmd.contains("org.apache.spark.deploy.SparkSubmit"));
7373
}
7474

75-
@Test(expected = IllegalArgumentException.class)
75+
@Test
7676
public void testCheckJavaOptionsThrowException() throws Exception {
7777
Map<String, String> env = new HashMap<>();
7878
List<String> sparkSubmitArgs = Arrays.asList(
@@ -84,7 +84,7 @@ public void testCheckJavaOptionsThrowException() throws Exception {
8484
"-Xmx64g -Dprop=Other -Dprop1=\"-Xmx -Xmx\" -Dprop2=\"-Xmx '-Xmx\" " +
8585
"-Dprop3='-Xmx -Xmx' -Dprop4='-Xmx \"-Xmx'",
8686
SparkLauncher.NO_RESOURCE);
87-
buildCommand(sparkSubmitArgs, env);
87+
assertThrows(IllegalArgumentException.class, () -> buildCommand(sparkSubmitArgs, env));
8888
}
8989

9090
@Test

0 commit comments

Comments
 (0)