Skip to content

Commit 8fbade6

Browse files
deps: bump com.google.truth:truth from 1.1.5 to 1.4.0 (#1323)
Bumps [com.google.truth:truth](https://togithub.com/google/truth) from 1.1.5 to 1.4.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://togithub.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://togithub.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>Optionally 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>In most cases, that can be further simplified to:</p> <pre lang="sh"><code>git grep -l Truth8 | xargs perl -pi -e 's/\bTruth8\b/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://togithub.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://togithub.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> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://togithub.com/google/truth/commit/2e8e48845cfa51a457ee150fe4b620e847c968c9"><code>2e8e488</code></a> Set version number for truth-parent to 1.4.0.</li> <li><a href="https://togithub.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://togithub.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://togithub.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://togithub.com/google/truth/commit/09993692eae0f278eea6fa123b1a5e4ecdd00720"><code>0999369</code></a> Automated Code Change</li> <li><a href="https://togithub.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://togithub.com/google/truth/commit/87b371df11b3d2f477a29b6568c943daffa50643"><code>87b371d</code></a> Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1</li> <li><a href="https://togithub.com/google/truth/commit/93b4d93721ae84b10590963f8cf17364af8ce385"><code>93b4d93</code></a> Add <code>@SInCE</code> tags for the first batch of Java-8-related APIs.</li> <li><a href="https://togithub.com/google/truth/commit/78d27dd4716c06afdd4df47485716cda1d8fe80a"><code>78d27dd</code></a> Remove stale suppressions.</li> <li><a href="https://togithub.com/google/truth/commit/7be930d21593375dbecbd39352fd38862f7a2cec"><code>7be930d</code></a> Bump actions/cache from 3.3.3 to 4.0.0</li> <li>Additional commits viewable in <a href="https://togithub.com/google/truth/compare/v1.1.5...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.1.5&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>
1 parent 4ee028e commit 8fbade6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

datastore-v1-proto-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<dependency>
9999
<groupId>com.google.truth</groupId>
100100
<artifactId>truth</artifactId>
101-
<version>1.1.5</version>
101+
<version>1.4.0</version>
102102
<scope>test</scope>
103103
<exclusions>
104104
<exclusion>

google-cloud-datastore/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
<dependency>
151151
<groupId>com.google.truth</groupId>
152152
<artifactId>truth</artifactId>
153-
<version>1.1.5</version>
153+
<version>1.4.0</version>
154154
<scope>test</scope>
155155
</dependency>
156156
</dependencies>

0 commit comments

Comments
 (0)