Skip to content

Commit 1dc2710

Browse files
committed
Fix the test logic to verify null and non-null cases.
1 parent d199657 commit 1dc2710

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.junit.Before;
2525
import org.junit.Test;
26+
import static org.mockito.ArgumentMatchers.isNull;
2627
import static org.mockito.Mockito.*;
2728

2829
public class SparkSubmitOptionParserSuite extends BaseSuite {
@@ -48,14 +49,17 @@ public void testAllOptions() {
4849
}
4950
}
5051

52+
int nullCount = 0;
5153
for (String[] switchNames : parser.switches) {
5254
int switchCount = 0;
5355
for (String name : switchNames) {
5456
parser.parse(Arrays.asList(name));
5557
count++;
58+
nullCount++;
5659
switchCount++;
5760
verify(parser, times(switchCount)).handle(eq(switchNames[0]), same(null));
58-
verify(parser, times(count)).handle(anyString(), any(String.class));
61+
verify(parser, times(nullCount)).handle(anyString(), isNull());
62+
verify(parser, times(count - nullCount)).handle(anyString(), any(String.class));
5963
verify(parser, times(count)).handleExtraArgs(eq(Collections.emptyList()));
6064
}
6165
}

0 commit comments

Comments
 (0)