google / google/truth

Method hasOnlyElementsOfType for Iterables

Open
#463 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

Hello everyone,

I was migrating from assertJ to Truth, and I found no alternative method to hasOnlyElementsOfType for Iterables.
I've used as an alternative this method:

```
private void assertHasOnlyElementsOfType(@NonNull final Iterable iterable, @NonNull final Class classType) {
for (Object object : iterable) {
assertThat(object).isInstanceOf(classType);
}
}
```

Could you consider adding something similar in the future?

Thanks in advance,
Keep up the awesome work!

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.