|
24 | 24 | import java.math.BigDecimal;
|
25 | 25 | import java.util.Map;
|
26 | 26 | import java.util.Optional;
|
| 27 | +import java.util.OptionalDouble; |
| 28 | +import java.util.OptionalInt; |
| 29 | +import java.util.stream.IntStream; |
| 30 | +import java.util.stream.LongStream; |
27 | 31 | import java.util.stream.Stream;
|
28 | 32 | import org.checkerframework.checker.nullness.qual.Nullable;
|
29 | 33 |
|
@@ -251,24 +255,59 @@ public static TableSubject assertThat(@Nullable Table<?, ?, ?> actual) {
|
251 | 255 | return assert_().that(actual);
|
252 | 256 | }
|
253 | 257 |
|
254 |
| - @SuppressWarnings("Java7ApiChecker") // no more dangerous that wherever the user got the Optional |
255 |
| - @GwtIncompatible // creates ambiguities (Eclipse bug 577808 or similar?) |
256 | 258 | /**
|
257 | 259 | * @since 1.3.0 (present in {@link Truth8} since before 1.0)
|
258 | 260 | */
|
| 261 | + @SuppressWarnings({ |
| 262 | + "Java7ApiChecker", // no more dangerous than wherever the user got the Optional |
| 263 | + "NullableOptional", // Truth always accepts nulls, no matter the type |
| 264 | + }) |
259 | 265 | public static <T> OptionalSubject assertThat(@Nullable Optional<T> actual) {
|
260 | 266 | return assert_().that(actual);
|
261 | 267 | }
|
262 | 268 |
|
263 |
| - @SuppressWarnings("Java7ApiChecker") // no more dangerous that wherever the user got the Stream |
264 |
| - @GwtIncompatible // creates ambiguities (Eclipse bug 577808 or similar?) |
265 | 269 | /**
|
266 | 270 | * @since 1.3.0 (present in {@link Truth8} since before 1.0)
|
267 | 271 | */
|
| 272 | + @SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream |
| 273 | + public static OptionalIntSubject assertThat(@Nullable OptionalInt actual) { |
| 274 | + return assert_().that(actual); |
| 275 | + } |
| 276 | + |
| 277 | + /** |
| 278 | + * @since 1.4.0 (present in {@link Truth8} since before 1.0) |
| 279 | + */ |
| 280 | + @SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream |
| 281 | + public static OptionalDoubleSubject assertThat(@Nullable OptionalDouble actual) { |
| 282 | + return assert_().that(actual); |
| 283 | + } |
| 284 | + |
| 285 | + /** |
| 286 | + * @since 1.4.0 (present in {@link Truth8} since before 1.0) |
| 287 | + */ |
| 288 | + @SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream |
268 | 289 | public static <T extends @Nullable Object> StreamSubject assertThat(@Nullable Stream<T> actual) {
|
269 | 290 | return assert_().that(actual);
|
270 | 291 | }
|
271 | 292 |
|
| 293 | + /** |
| 294 | + * @since 1.4.0 (present in {@link Truth8} since before 1.0) |
| 295 | + */ |
| 296 | + @SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream |
| 297 | + public static IntStreamSubject assertThat(@Nullable IntStream actual) { |
| 298 | + return assert_().that(actual); |
| 299 | + } |
| 300 | + |
| 301 | + /** |
| 302 | + * @since 1.4.0 (present in {@link Truth8} since before 1.0) |
| 303 | + */ |
| 304 | + @SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream |
| 305 | + public static LongStreamSubject assertThat(@Nullable LongStream actual) { |
| 306 | + return assert_().that(actual); |
| 307 | + } |
| 308 | + |
| 309 | + // TODO(b/64757353): Add support for DoubleStream? |
| 310 | + |
272 | 311 | /**
|
273 | 312 | * An {@code AssertionError} that (a) always supports a cause, even under old versions of Android
|
274 | 313 | * and (b) omits "java.lang.AssertionError:" from the beginning of its toString() representation.
|
|
0 commit comments