Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.google.common.truth.Truth.assertThat;
import static java.lang.String.CASE_INSENSITIVE_ORDER;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
import static org.junit.Assert.assertThrows;

import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -814,10 +815,12 @@ public void containsExactlyWithDuplicatesOutOfOrder() {
}

@Test
// We intentionally test the behavior of the method under a call that will soon fail.
@SuppressWarnings("NullNeedsCastForVarargs")
@J2ktIncompatible // Kotlin can't pass a null array for a varargs parameter
public void containsExactlyWithOnlyNullPassedAsNullArray() {
// Truth is tolerant of this erroneous varargs call.
Iterable<Object> actual = asList((Object) null);
Iterable<Object> actual = singleton(null);
// We are changing Truth from tolerating this erroneous varargs call to not tolerating it.
try {
assertThat(actual).containsExactly((Object[]) null);
} catch (NullPointerException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.google.common.truth.FailureAssertions.assertFailureValue;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;

import java.util.stream.Stream;
import org.junit.Test;
Expand Down Expand Up @@ -316,8 +317,11 @@ public void containsExactly_nullObject() {

@Test
@J2ktIncompatible // Kotlin can't pass a null array for a varargs parameter
// We intentionally test the behavior of the method under a call that will soon fail.
@SuppressWarnings("NullNeedsCastForVarargs")
public void containsExactly_nullObjectArray() {
StreamSubject subject = assertThat(Stream.of((Object) null));
StreamSubject subject = assertThat(singleton(null).stream());
// We are changing Truth from tolerating this erroneous varargs call to not tolerating it.
try {
subject.containsExactly((Object[]) null);
} catch (NullPointerException e) {
Expand Down