Skip to content

Commit

Permalink
Fixes mockito#583 added one more test to check behavior for null arra…
Browse files Browse the repository at this point in the history
…y reference
  • Loading branch information
lukasz-szewc committed Aug 28, 2016
1 parent e112fb7 commit 8a42098
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public void captures_correctly_when_captor_used_on_pure_vararg_method() throws E
}

@Test
public void should_capture_null_vararg() {
public void should_capture_null_single_argument_in_vararg_method() {
// given
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);

Expand All @@ -328,4 +328,18 @@ public void should_capture_null_vararg() {
verify(mock).varargs(argumentCaptor.capture());
Assertions.assertThat(argumentCaptor.getValue()).isNull();
}

@Test
public void should_capture_null_array_in_method_vararg() {
// given
ArgumentCaptor<String[]> argumentCaptor = ArgumentCaptor.forClass(String[].class);

// when
String[] nullArray = null;
mock.varargs(nullArray);

// then
verify(mock).varargs(argumentCaptor.capture());
Assertions.assertThat(argumentCaptor.getValue()).isNull();
}
}

0 comments on commit 8a42098

Please sign in to comment.