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

build(deps): Bump truth from 1.1.3 to 1.4.2 #5191

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 28, 2024

Bumps truth from 1.1.3 to 1.4.2.
Updates com.google.truth:truth from 1.1.3 to 1.4.2

Release notes

Sourced from com.google.truth:truth's releases.

1.4.2

This release is the final step of copying all our methods from Truth8 to Truth. If you have not already migrated your usages from Truth8 to Truth, you may see build errors:

OptionalSubjectTest.java:39: error: reference to assertThat is ambiguous
    assertThat(Optional.of("foo")).isPresent();
    ^
  both method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Optional<?>) in Truth8 and method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Optional<?>) in Truth match

In most cases, you can migrate your whole project mechanically: git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/Truth/g;'. (You can make that change before upgrading to Truth 1.4.2 or as part of the same commit.)

If you instead need to migrate your project incrementally (for example, because it is very large), you may want to upgrade your version of Truth incrementally, too, following our instructions for 1.3.0 and 1.4.0.

For help

Please feel welcome to open an issue to report problems or request help.

Changelog

  • Removed temporary type parameters from Truth.assertThat(Stream) and Truth.assertThat(Optional). This can create build errors, which you can fix by replacing all your references to Truth8 with references to Truth. (45782bd0e)

1.4.1

This release deprecates Truth8.

All its methods have become available on the main Truth class. In most cases, you can migrate your whole project mechanically: git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/Truth/g;'

While we do not plan to delete Truth8, we recommend migrating off it, at least if you static import assertThat: If you do not migrate, such static imports will become ambiguous in Truth 1.4.2, breaking your build.

1.4.0

In this release, our assertions on Java 8 types continue to move from the Truth8 class to the main Truth class. This change should not break compatibility for any supported JDK or Android version, even users who test under old versions of Android without API desugaring. Additionally, we will never break binary compatibility, though some users will have to make changes to their source code in order for it to compile against newer versions.

This release is likely to lead to more build failures than 1.3.0 did. However, those failures should be straightforward to fix.

Example build failure

Foo.java:152: error: reference to assertThat is ambiguous
    assertThat(repo.findFileWithName("foo")).isNull();
    ^
  both method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Path) in Truth8 and method assertThat(@org.checkerframework.checker.nullness.qual.Nullable Path) in Truth match

Simplest upgrade strategy (if you can update all your code atomically in the same commit as the Truth upgrade)

In the same commit:

  1. Upgrade Truth to 1.4.0.
  2. Replace import static com.google.common.truth.Truth8.assertThat; with import static com.google.common.truth.Truth.assertThat;.

... (truncated)

Commits

Updates com.google.truth.extensions:truth-java8-extension from 1.1.3 to 1.4.2

You can trigger a rebase of this PR 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 show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @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)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps `truth` from 1.1.3 to 1.4.2.

Updates `com.google.truth:truth` from 1.1.3 to 1.4.2
- [Release notes](https://github.com/google/truth/releases)
- [Commits](https://github.com/google/truth/commits/v1.4.2)

Updates `com.google.truth.extensions:truth-java8-extension` from 1.1.3 to 1.4.2

---
updated-dependencies:
- dependency-name: com.google.truth:truth
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.google.truth.extensions:truth-java8-extension
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot requested a review from a team as a code owner March 28, 2024 09:45
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Mar 28, 2024
Copy link

sonarcloud bot commented Mar 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

cpovirk added a commit to cpovirk/openfoodfacts-androidapp that referenced this pull request Apr 1, 2024
This requires adapting to Truth's recent nullness annotations.

Specifically, a `Subject` constructor (and the associated
`Subject.Factory` and `assertThat` function) should accept a null actual
value. By doing so, it makes it possible to write
`assertThat(foo).isNull()`, for example.

This does not necessarily mean that all assertions will _pass_ if the caller
passes `null`. Obviously `isNotNull()` will fail, of course, but so too may
other assertions, like `hasFoundProducts` will here.

(In principle, it would be nice for all assertions to fail _with
detailed `NullPointerException` messages_. In practice, we mostly
haven't done that even for the core Truth assertions. So I haven't here,
either.)

Without this PR, the error that Truth 1.4.2 produces is:

```
ProductsAPITest.kt:245:46 Type mismatch: inferred type is KFunction2<FailureMetadata, Search, ProductsAPITest.SearchSubject> but (FailureMetadata!, TypeVariable(ActualT)?) -> TypeVariable(SubjectT)! was expected
```

Fixes openfoodfacts#5191
@cpovirk
Copy link

cpovirk commented Apr 1, 2024

I've created #5194 to perform the update and fix the one error it produces.

(At least, that fixes the one error that I saw in the results so far :) I'll watch for the CI results on the new PR [edit: ah, assuming that it gets approved to run].)

cpovirk added a commit to cpovirk/openfoodfacts-androidapp that referenced this pull request Apr 1, 2024
This requires adapting to Truth's recent nullness annotations.

Specifically, a `Subject` constructor (and the associated
`Subject.Factory` and `assertThat` function) should accept a null actual
value. By doing so, it makes it possible to write
`assertThat(foo).isNull()`, for example.

This does not necessarily mean that all assertions will _pass_ if the caller
passes `null`. Obviously `isNotNull()` will fail, of course, but so too may
other assertions, like `hasFoundProducts` will here.

(In principle, it would be nice for all assertions to fail _with
detailed `NullPointerException` messages_. In practice, we mostly
haven't done that even for the core Truth assertions. So I haven't here,
either.)

Without this PR, the error that Truth 1.4.2 produces is:

```
ProductsAPITest.kt:245:46 Type mismatch: inferred type is KFunction2<FailureMetadata, Search, ProductsAPITest.SearchSubject> but (FailureMetadata!, TypeVariable(ActualT)?) -> TypeVariable(SubjectT)! was expected
```

Fixes openfoodfacts#5191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant