Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "value of" lines work with StreamSubject. #1224

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

copybara-service[bot]
Copy link
Contributor

Make "value of" lines work with StreamSubject.

...by migrating off the deprecated no-arg check() overload.

Usages of that method cause problems for "value of" lines.

Also, fill in a typeDescriptionOverride value for MultisetSubject. This is largely a no-op, but it helps under GWT/J2CL (where we can't infer the type name).

I left IterableSubject itself without a typeDescriptionOverride, since it has subclasses outside the package, some of which may prefer the more specific names (which are normally automatically derived from the Subject class's name—e.g., AttributeListSubject would result in value of: attributeList.size()). In hindsight, I guess that I could have given direct usages of IterableSubject a typeDescriptionOverride (by making StandardSubjectBuilder pass one), but that seems like more effort than is worthwhile now that I've already tested this CL as it stands.

RELNOTES=n/a

...by migrating off the deprecated no-arg `check()` overload.

Usages of that method [cause problems for "value of" lines](https://github.com/google/truth/blob/37fd8bea90c0ab4528c4c922c88fa176eb45f65b/core/src/main/java/com/google/common/truth/FailureMetadata.java#L230-L232).

Also, fill in a `typeDescriptionOverride` value for `MultisetSubject`. This is largely a no-op, but it helps under GWT/J2CL (where [we can't infer the type name](https://github.com/google/truth/blob/37fd8bea90c0ab4528c4c922c88fa176eb45f65b/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java#L72)).

I left `IterableSubject` itself without a `typeDescriptionOverride`, since it has subclasses outside the package, some of which may prefer the more specific names (which are normally automatically derived from the `Subject` class's name—e.g., `AttributeListSubject` would result in `value of: attributeList.size()`). In hindsight, I guess that I could have given _direct_ usages of `IterableSubject` a `typeDescriptionOverride` (by making `StandardSubjectBuilder` pass one), but that seems like more effort than is worthwhile now that I've already tested this CL as it stands.

RELNOTES=n/a
PiperOrigin-RevId: 598964798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant