truth
truth copied to clipboard
DoubleStreamSubject
Please, consider:
- Truth8.assertThat(IntStream),
- Truth8.assertThat(LongStream),
- Truth8.assertThat(DoubleStream).
As a workaround, I use Thruth.assertThat(actual.toArray()).isEqualTo(expected.toArray())
, but that's a little more verbose.
Hmm, seems like we could just change Stream
to BaseStream
and everything should still work. But there might be a reason we didn't do this...I'll take a look.
OK, turns out it wasn't as simple, because without custom LongStreamSubject
, this assertion would fail:
// LongStream.of() upcasts the ints to longs
assertThat(LongStream.of(1, 2, 3)).containsExactly(1, 2, 3);
// but containsExactly(Object...) boxes the ints to Integers, and the assertion fails
So we're going to go ahead and add IntStreamSubject
and LongStreamSubject
. The API for DoubleStreamSubject
will be a bit more controversial, and we're leaving it as a TODO for now.
FWIW, DoubleStream
's are about 1/3 as common as IntStream
or LongStream
inside of Google.