Release notes
*Sourced from [truth's releases](https://github.com/google/truth/releases).*
> ## Truth 1.0
> Truth is a library for performing assertions in tests:
>
> ```java
> assertThat(notificationText).contains("testuser@google.com");
> ```
>
> Truth is owned and maintained by the [Guava](http://github.com/google/guava) team. It is used in the majority of the tests in Google’s own codebase.
>
> For more information, see our full documentation at [truth.dev](https://truth.dev/), or start with our [higher-level blog post](https://opensource.googleblog.com/2019/07/truth-10-fluent-assertions-for-java-and.html).
>
> Users of [AssertJ](https://joel-costigliola.github.io/assertj/) will be particularly interested in our [comparison of Truth and AssertJ](https://truth.dev/comparison#why-create-truth-when-assertj-already-exists).
>
> ---
>
> Truth 1.0 contains no changes relative to 1.0-rc2. For a list of changes since Truth 0.46, see the release notes for [rc1](https://github.com/google/truth/releases/tag/release_1_0_rc1) and [rc2](https://github.com/google/truth/releases/tag/release_1_0_rc2).
>
> Now that we have reached 1.0 (after [eight years](https://github.com/google/truth/commit/813afacc95b5f7ae2d38f10a10ca095b8c69b2b3)! We're sorry, and we thank you again for your patience), we will maintain binary compatibility.
>
> ## Truth 0.46
> - Removed deprecated `containsAllOf` and `containsAllIn`. Use `containsAtLeast` and `containsAtLeastElementsIn`, which are equivalent. (5de3d216)
> - Removed deprecated `isOrdered` and `isStrictlyOrdered`. Use `isInOrder` and `isInStrictOrder`, which are equivalent. (5de3d216)
> - Removed deprecated `SortedMapSubject` and `SortedSetSubject`. Users will have to perform assertions directly on the result of methods like `firstKey`. We haven't found sufficient demand for the classes to keep them. (057ef315)
> - Removed deprecated `ListMultimapSubject`, `SetMultimapSubject`, and ProtoTruth equivalents, which add little to the general `Multimap` subjects. (057ef315)
> - Removed the type parameters from `Subject`. If you subclass this type (or declare it as a method return type, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (3740ee65) To remove the type parameters from `Subject` subclasses, you can get most of the way there with a Perl-compatible regex search-and-replace operation: `s/\bSubject<([^<>]*|[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*>[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*<[^<>]*>[^<>]*>)>/Subject/g`
> - Removed the self-type parameter of `ComparableSubject` and most of the type parameters of `IterableOfProtosSubject`, `MapWithProtoValuesSubject`, and `MultimapWithProtoValuesSubject`. If you subclass any of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages, update Truth, and then add back the remaining type parameters. (e611568b)
> - Removed the type parameters of `ProtoSubject` and `LiteProtoSubject`. If you subclass either of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (eb3852c4)
> - Removed deprecated `actual()`, `getSubject()`, `named()`, `internalCustomName()`, and `actualAsString()`. To automate most migrations, we've provided [`StoreActualValueInField`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/StoreActualValueInField.java) and [`NamedToWithMessage`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/NamedToWithMessage.java) (and [a quick-and-dirty regex version for common cases](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/NamedToWithMessage.java#L57)). You might be interested in [our notes from the API Review of this decision](https://truth.dev/subject_named_actual_type_parameters). (c1db1b78)
> - Changed `ProtoSubject` to not extend `ProtoFluentAssertion`. It still contains all the same methods, except that `isEqualTo` and `isNotEqualTo` now require a `Message`, rather than accept any `Object`. (777af33d)
> - Deprecated the overload of `StandardSubjectBuilder.fail(...)` that accepts a message. Instead of `assert_().fail(...)`, use `assertWithMessage(...).fail()`. Similarly, instead of `expect.fail(...)`, use `expect.withMessage(...).fail()`, and so forth. (227b559e)
> - Deprecated `AtomicLongMapSubject`. In most cases, you can [assert on the `asMap()` view instead](https://github-redirect.dependabot.com/google/truth/issues/579). (19e1f22c)
> - Deprecated `Optional*Subject.hasValueThat()`. Instead of `assertThat(optional).hasValueThat()....`, use `assertThat(optional.getAs*())....`. (227b559e)
> - Changed `assertWithMessage` to throw an exception if given format arguments but a null format string. (31e44cc3d2597b90986122853c149d68ea2c5cde)
> - Reimplemented the message-accepting overload of `fail(...)` in terms of `withMessage(...)`. This is mostly a no-op but can affect behavior in unusual cases. For details, see the commit description. (a52f89b9)
> - Made `IterableSubject.isEqualTo` produce the same message format as `containsExactly`. (27a9111c504648ab830929730d6a2b0face5d23d)
> - Introduced `TruthFailureSubject.truthFailures()` factory for callers that want to test Truth failure messages with `expect`, `assertWithMessage`, etc. (c1db1b78)
>
> ## Truth 0.45
> We are pushing hard to release a Truth 1.0 by June 30, after which we don't expect to remove any more APIs. Thanks for your patience with both our slow progress over the past several years and our rapid churn now.
>
> To use the migration tools below, you'll need to [set up Error Prone](https://errorprone.info/docs/installation) and [configure our tools as plugins](https://errorprone.info/docs/plugins) to [run in patch mode](https://errorprone.info/docs/patching).
>
> Deletions:
> - Removed deprecated `Subject.isSameAs` and `isNotSameAs`. Use `isSameInstanceAs` and `isNotSameInstanceAs`, which are equivalent. (36200e6a)
> - Hid the constuctor of `Correspondence`. Use the class's static factory methods instead. The most mechanical migration is usually to `Correspondence.from`. To help with migration, we're released [`CorrespondenceSubclassToFactoryCall`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/CorrespondenceSubclassToFactoryCall.java). (11da1ca2)
> - Removed deprecated `Subject.fail*` methods. See `Subject.failWithActual` and `failWithoutActual`, which use the new `Fact` class. To help with migration, we're released [`FailWithFacts`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/FailWithFacts.java) (and also [`ImplementAssertionWithChaining`](https://github.com/google/error-prone/blob/master/core/src/main/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChaining.java), which is also sometimes useful for these migrations), though you will likely need to make manual changes, as well. (36200e6a)
> - Removed deprecated no-arg `Subject.check()`. Use the overload that accepts a description. (To help with this migration, we have added [`ProvideDescriptionToCheck`](https://github.com/google/error-prone/blob/8f3ac0077261cded0de983fe9c9cde20fb92d744/core/src/main/java/com/google/errorprone/bugpatterns/ProvideDescriptionToCheck.java) to [Error Prone](https://github.com/google/error-prone) -- but then removed it before it became part of a release, so you'll need to pull it in manually.) (36200e6a)
> - Removed deprecated `MathUtil`. For similar static methods, see Guava's [`DoubleMath.fuzzyEquals`](https://google.github.io/guava/releases/snapshot-jre/api/docs/com/google/common/math/DoubleMath.html#fuzzyEquals-double-double-double-). But callers from custom `Subject` implementations may prefer an approach like `check("score()").that(actual.score()).isWithin(tolerance).of(expected)`. (7b2876d0)
> - Removed deprecated `createAndEnableStackTrace()`. Use `create()`, which now also enables stack traces. (9362f4cb)
>
> ... (truncated)
Commits
- See full diff in [compare view](https://github.com/google/truth/commits)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
Bumps truth from 0.42 to 1.0.
Release notes
*Sourced from [truth's releases](https://github.com/google/truth/releases).* > ## Truth 1.0 > Truth is a library for performing assertions in tests: > > ```java > assertThat(notificationText).contains("testuser@google.com"); > ``` > > Truth is owned and maintained by the [Guava](http://github.com/google/guava) team. It is used in the majority of the tests in Google’s own codebase. > > For more information, see our full documentation at [truth.dev](https://truth.dev/), or start with our [higher-level blog post](https://opensource.googleblog.com/2019/07/truth-10-fluent-assertions-for-java-and.html). > > Users of [AssertJ](https://joel-costigliola.github.io/assertj/) will be particularly interested in our [comparison of Truth and AssertJ](https://truth.dev/comparison#why-create-truth-when-assertj-already-exists). > > --- > > Truth 1.0 contains no changes relative to 1.0-rc2. For a list of changes since Truth 0.46, see the release notes for [rc1](https://github.com/google/truth/releases/tag/release_1_0_rc1) and [rc2](https://github.com/google/truth/releases/tag/release_1_0_rc2). > > Now that we have reached 1.0 (after [eight years](https://github.com/google/truth/commit/813afacc95b5f7ae2d38f10a10ca095b8c69b2b3)! We're sorry, and we thank you again for your patience), we will maintain binary compatibility. > > ## Truth 0.46 > - Removed deprecated `containsAllOf` and `containsAllIn`. Use `containsAtLeast` and `containsAtLeastElementsIn`, which are equivalent. (5de3d216) > - Removed deprecated `isOrdered` and `isStrictlyOrdered`. Use `isInOrder` and `isInStrictOrder`, which are equivalent. (5de3d216) > - Removed deprecated `SortedMapSubject` and `SortedSetSubject`. Users will have to perform assertions directly on the result of methods like `firstKey`. We haven't found sufficient demand for the classes to keep them. (057ef315) > - Removed deprecated `ListMultimapSubject`, `SetMultimapSubject`, and ProtoTruth equivalents, which add little to the general `Multimap` subjects. (057ef315) > - Removed the type parameters from `Subject`. If you subclass this type (or declare it as a method return type, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (3740ee65) To remove the type parameters from `Subject` subclasses, you can get most of the way there with a Perl-compatible regex search-and-replace operation: `s/\bSubject<([^<>]*|[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*>[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*<[^<>]*>[^<>]*>)>/Subject/g` > - Removed the self-type parameter of `ComparableSubject` and most of the type parameters of `IterableOfProtosSubject`, `MapWithProtoValuesSubject`, and `MultimapWithProtoValuesSubject`. If you subclass any of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages, update Truth, and then add back the remaining type parameters. (e611568b) > - Removed the type parameters of `ProtoSubject` and `LiteProtoSubject`. If you subclass either of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (eb3852c4) > - Removed deprecated `actual()`, `getSubject()`, `named()`, `internalCustomName()`, and `actualAsString()`. To automate most migrations, we've provided [`StoreActualValueInField`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/StoreActualValueInField.java) and [`NamedToWithMessage`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/NamedToWithMessage.java) (and [a quick-and-dirty regex version for common cases](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/NamedToWithMessage.java#L57)). You might be interested in [our notes from the API Review of this decision](https://truth.dev/subject_named_actual_type_parameters). (c1db1b78) > - Changed `ProtoSubject` to not extend `ProtoFluentAssertion`. It still contains all the same methods, except that `isEqualTo` and `isNotEqualTo` now require a `Message`, rather than accept any `Object`. (777af33d) > - Deprecated the overload of `StandardSubjectBuilder.fail(...)` that accepts a message. Instead of `assert_().fail(...)`, use `assertWithMessage(...).fail()`. Similarly, instead of `expect.fail(...)`, use `expect.withMessage(...).fail()`, and so forth. (227b559e) > - Deprecated `AtomicLongMapSubject`. In most cases, you can [assert on the `asMap()` view instead](https://github-redirect.dependabot.com/google/truth/issues/579). (19e1f22c) > - Deprecated `Optional*Subject.hasValueThat()`. Instead of `assertThat(optional).hasValueThat()....`, use `assertThat(optional.getAs*())....`. (227b559e) > - Changed `assertWithMessage` to throw an exception if given format arguments but a null format string. (31e44cc3d2597b90986122853c149d68ea2c5cde) > - Reimplemented the message-accepting overload of `fail(...)` in terms of `withMessage(...)`. This is mostly a no-op but can affect behavior in unusual cases. For details, see the commit description. (a52f89b9) > - Made `IterableSubject.isEqualTo` produce the same message format as `containsExactly`. (27a9111c504648ab830929730d6a2b0face5d23d) > - Introduced `TruthFailureSubject.truthFailures()` factory for callers that want to test Truth failure messages with `expect`, `assertWithMessage`, etc. (c1db1b78) > > ## Truth 0.45 > We are pushing hard to release a Truth 1.0 by June 30, after which we don't expect to remove any more APIs. Thanks for your patience with both our slow progress over the past several years and our rapid churn now. > > To use the migration tools below, you'll need to [set up Error Prone](https://errorprone.info/docs/installation) and [configure our tools as plugins](https://errorprone.info/docs/plugins) to [run in patch mode](https://errorprone.info/docs/patching). > > Deletions: > - Removed deprecated `Subject.isSameAs` and `isNotSameAs`. Use `isSameInstanceAs` and `isNotSameInstanceAs`, which are equivalent. (36200e6a) > - Hid the constuctor of `Correspondence`. Use the class's static factory methods instead. The most mechanical migration is usually to `Correspondence.from`. To help with migration, we're released [`CorrespondenceSubclassToFactoryCall`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/CorrespondenceSubclassToFactoryCall.java). (11da1ca2) > - Removed deprecated `Subject.fail*` methods. See `Subject.failWithActual` and `failWithoutActual`, which use the new `Fact` class. To help with migration, we're released [`FailWithFacts`](https://github.com/google/truth/blob/master/refactorings/src/main/java/com/google/common/truth/refactorings/FailWithFacts.java) (and also [`ImplementAssertionWithChaining`](https://github.com/google/error-prone/blob/master/core/src/main/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChaining.java), which is also sometimes useful for these migrations), though you will likely need to make manual changes, as well. (36200e6a) > - Removed deprecated no-arg `Subject.check()`. Use the overload that accepts a description. (To help with this migration, we have added [`ProvideDescriptionToCheck`](https://github.com/google/error-prone/blob/8f3ac0077261cded0de983fe9c9cde20fb92d744/core/src/main/java/com/google/errorprone/bugpatterns/ProvideDescriptionToCheck.java) to [Error Prone](https://github.com/google/error-prone) -- but then removed it before it became part of a release, so you'll need to pull it in manually.) (36200e6a) > - Removed deprecated `MathUtil`. For similar static methods, see Guava's [`DoubleMath.fuzzyEquals`](https://google.github.io/guava/releases/snapshot-jre/api/docs/com/google/common/math/DoubleMath.html#fuzzyEquals-double-double-double-). But callers from custom `Subject` implementations may prefer an approach like `check("score()").that(actual.score()).isWithin(tolerance).of(expected)`. (7b2876d0) > - Removed deprecated `createAndEnableStackTrace()`. Use `create()`, which now also enables stack traces. (9362f4cb) > > ... (truncated)Commits
- See full diff in [compare view](https://github.com/google/truth/commits)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot.