google / google/truth

Consider adding `StringSubject.containsAll([String...|Iterable<String>])`

Open
#368 5 comments 0 reactions 0 assignees View on GitHub
P3 type=addition
Dominant language
Java
Stars
2.8k
Forks
275
Avg merge
7m
Merged PRs (30d)
4

Description

I bumped into this yesterday on a work project - I was personally surprised to see that these aren't valid assertions in Truth:

```java
assertThat("One ring to rule them all").containsAll("One", "all", "rule");
assertThat("One ring to rule them all").containsAll(ImmutableSet.of("to", "them", "One"));
```

I actually wrote a `StringSubject2` class with `containsAll(Iterable)` method and associated tests yesterday to cover this need.

Am I missing something obvious in `StringSubject` or elsewhere in Truth that would meet my need?

If not, would this be something the Truth team would be willing to consider, and would the team be happy to accept a PR with the code I developed to kick the discussion off?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.