Skip to content

Commit

Permalink
Bump com.google.truth:truth from 1.3.0 to 1.4.0
Browse files Browse the repository at this point in the history
Bumps [com.google.truth:truth](https://github.com/google/truth) from 1.3.0 to 1.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/google/truth/releases">com.google.truth:truth's releases</a>.</em></p>
<blockquote>
<h2>1.4.0</h2>
<p>In this release, our assertions on Java 8 types continue to move from the <code>Truth8</code> class to the main <code>Truth</code> class. This change should not break compatibility for any supported JDK or Android version, even users who test under old versions of Android without <a href="https://developer.android.com/studio/write/java8-support#library-desugaring">API desugaring</a>. 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.</p>
<p>This release is likely to lead to more <strong>build failures</strong> than <a href="https://github.com/google/truth/releases/tag/v1.3.0">1.3.0</a> did. However, those failures should be <strong>straightforward to fix</strong>.</p>
<h2>Example build failure</h2>
<pre><code>Foo.java:152: error: reference to assertThat is ambiguous
    assertThat(repo.findFileWithName(&quot;foo&quot;)).isNull();
    ^
  both method assertThat(@org.jspecify.nullness.Nullable Path) in Truth8 and method assertThat(@org.jspecify.nullness.Nullable Path) in Truth match
</code></pre>
<h2>Simplest upgrade strategy (if you can update all your code atomically in the same commit as the Truth upgrade)</h2>
<p>In the same commit:</p>
<ol>
<li>Upgrade Truth to 1.4.0.</li>
<li>Replace <code>import static com.google.common.truth.Truth8.assertThat;</code> with <code>import static com.google.common.truth.Truth.assertThat;</code>.
<ul>
<li>If you use Kotlin, replace <code>import com.google.common.truth.Truth8.assertThat</code> with <code>import com.google.common.truth.Truth.assertThat</code>.</li>
</ul>
</li>
<li>Replace <code>import com.google.common.truth.Truth8;</code> with <code>import com.google.common.truth.Truth;</code>.
<ul>
<li>again, similarly for Kotlin if needed</li>
</ul>
</li>
<li>Replace remaining references to <code>Truth8</code> with references to <code>Truth</code>.
<ul>
<li>For example, replace <code>Truth8.assertThat(optional).isPresent()</code> with <code>Truth.assertThat(optional).isPresent()</code>.</li>
</ul>
</li>
</ol>
<p>If you're feeling lucky, you can try this one-liner for the code updates:</p>
<pre lang="sh"><code>git grep -l Truth8 | xargs perl -pi -e 's/import static com.google.common.truth.Truth8.assertThat;/import static com.google.common.truth.Truth.assertThat;/g; s/import com.google.common.truth.Truth8.assertThat/import com.google.common.truth.Truth.assertThat/g; s/import com.google.common.truth.Truth8/import com.google.common.truth.Truth/g; s/\bTruth8[.]/Truth./g;'
</code></pre>
<p>After that process, it is possible that you'll still see build errors from ambiguous usages of <code>assertThat</code> static imports. If so, you can find a workaround in the section about overload ambiguity in the release notes for <a href="https://github.com/google/truth/releases/tag/v1.3.0">1.3.0</a>. Alternatively, you can wait to upgrade until after a future Truth release, which will eliminate the ambiguity by changing the signatures of some <code>Truth.assertThat</code> overloads.</p>
<h2>Incremental upgrade strategy</h2>
<p>If you have a very large repo or you have other reasons to prefer to upgrade incrementally, you can use the approach that we used inside Google. Roughly, that approach was:</p>
<ol>
<li>Make the optional changes discussed in the release notes for <a href="https://github.com/google/truth/releases/tag/v1.3.0">1.3.0</a>.</li>
<li>For any remaining calls to <code>Truth8.assertThat</code>, change them to <em>avoid</em> static import.
<ul>
<li>That is, replace <code>assertThat(optional).isPresent()</code> with <code>Truth8.assertThat(optional).isPresent()</code>.</li>
</ul>
</li>
<li>Upgrade Truth to 1.4.0.</li>
<li>Optionally replace references to <code>Truth8</code> with references to <code>Truth</code> (including restoring static imports if desired), as discussed in section about the simple upgrade strategy above.</li>
</ol>
<h2>Optional additional changes</h2>
<ul>
<li>If you use <code>assertWithMessage(...).about(intStreams()).that(...)</code>, <code>expect.about(optionalLongs()).that(...)</code>, or similar, you can remove your call to <code>about</code>. This change will never be necessary; it is just a simplification.
<ul>
<li>This is similar to a previous optional change from <a href="https://github.com/google/truth/releases/tag/v1.3.0">1.3.0</a>, except that 1.3.0 solved this problem for <code>streams</code> and <code>optionals</code>, whereas 1.4.0 solves it for the other <code>Truth8</code> types.</li>
</ul>
</li>
</ul>
<h2>For help</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/google/truth/commit/2e8e48845cfa51a457ee150fe4b620e847c968c9"><code>2e8e488</code></a> Set version number for truth-parent to 1.4.0.</li>
<li><a href="https://github.com/google/truth/commit/1f81827f1b5512cb1bb4e09b1cd688337b155e0c"><code>1f81827</code></a> Copy <code>Truth8.assertThat</code> overloads for <code>Path</code> and <code>OptionalLong</code> to the main ...</li>
<li><a href="https://github.com/google/truth/commit/9be8e774ca41a2a85c49d203bc47dac78861aeaa"><code>9be8e77</code></a> Copy remaining <code>Truth8.assertThat</code> overloads to the main <code>Truth</code> class—except...</li>
<li><a href="https://github.com/google/truth/commit/b02a6583a9c9e6db9cf3725f542743ec0faf055f"><code>b02a658</code></a> Migrate most usages of <code>Truth8.assertThat</code> to equivalent usages of `Truth.ass...</li>
<li><a href="https://github.com/google/truth/commit/09993692eae0f278eea6fa123b1a5e4ecdd00720"><code>0999369</code></a> Automated Code Change</li>
<li><a href="https://github.com/google/truth/commit/7c65fc611d102c82b7218073315421656a5a19ca"><code>7c65fc6</code></a> Make it possible to write <code>expect.that(optionalInt).isPresent()</code>, `assertWith...</li>
<li><a href="https://github.com/google/truth/commit/87b371df11b3d2f477a29b6568c943daffa50643"><code>87b371d</code></a> Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1</li>
<li>See full diff in <a href="https://github.com/google/truth/compare/v1.3.0...v1.4.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.truth:truth&package-manager=maven&previous-version=1.3.0&new-version=1.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

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-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

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)

</details>

Fixes #311

COPYBARA_INTEGRATE_REVIEW=#311 from google:dependabot/maven/com.google.truth-truth-1.4.0 6f3d084
PiperOrigin-RevId: 604365872
  • Loading branch information
dependabot[bot] authored and Jimfs Team committed Feb 5, 2024
1 parent ef48313 commit 0e25a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down

0 comments on commit 0e25a1e

Please sign in to comment.