Skip to content

Commit

Permalink
Fix the test logic to verify null and non-null cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjoon-hyun committed Jan 4, 2019
1 parent d199657 commit 1dc2710
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.junit.Before;
import org.junit.Test;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.*;

public class SparkSubmitOptionParserSuite extends BaseSuite {
Expand All @@ -48,14 +49,17 @@ public void testAllOptions() {
}
}

int nullCount = 0;
for (String[] switchNames : parser.switches) {
int switchCount = 0;
for (String name : switchNames) {
parser.parse(Arrays.asList(name));
count++;
nullCount++;
switchCount++;
verify(parser, times(switchCount)).handle(eq(switchNames[0]), same(null));
verify(parser, times(count)).handle(anyString(), any(String.class));
verify(parser, times(nullCount)).handle(anyString(), isNull());
verify(parser, times(count - nullCount)).handle(anyString(), any(String.class));
verify(parser, times(count)).handleExtraArgs(eq(Collections.emptyList()));
}
}
Expand Down

0 comments on commit 1dc2710

Please sign in to comment.