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
test: cleaning up deprecated usages #858
Conversation
Codecov Report
@@ Coverage Diff @@
## master #858 +/- ##
=========================================
Coverage 78.66% 78.67%
Complexity 1167 1167
=========================================
Files 204 204
Lines 5152 5154 +2
Branches 413 413
=========================================
+ Hits 4053 4055 +2
Misses 925 925
Partials 174 174
Continue to review full report at Codecov.
|
gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcCallContextTest.java
Outdated
Show resolved
Hide resolved
You can catch more specific types than java.lang.Exception for more precise tests here.
gax-grpc/src/test/java/com/google/api/gax/grpc/ProtoOperationTransformersTest.java
Outdated
Show resolved
Hide resolved
gax-grpc/src/test/java/com/google/api/gax/grpc/ProtoOperationTransformersTest.java
Outdated
Show resolved
Hide resolved
gax-grpc/src/test/java/com/google/api/gax/grpc/ProtoOperationTransformersTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageOperationTransformersTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageOperationTransformersTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java
Outdated
Show resolved
Hide resolved
gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java
Outdated
Show resolved
Hide resolved
gax/src/test/java/com/google/api/gax/batching/ThresholdBatcherTest.java
Outdated
Show resolved
Hide resolved
noit sure why this failed:
FAILURE: Build failed with an exception.
- What went wrong:
A problem occurred configuring root project 'gax-java'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve net.ltgt.gradle:gradle-apt-plugin:0.10.
Required by:
project :
> Could not resolve net.ltgt.gradle:gradle-apt-plugin:0.10.
> Could not get resource 'https://plugins.gradle.org/m2/net/ltgt/gradle/gradle-apt-plugin/0.10/gradle-apt-plugin-0.10.pom'.
> Could not GET 'https://plugins.gradle.org/m2/net/ltgt/gradle/gradle-apt-plugin/0.10/gradle-apt-plugin-0.10.pom'.
> sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
Could not resolve gradle.plugin.com.dorongold.plugins:task-tree:1.3.1.
Required by:
project :
> Could not resolve gradle.plugin.com.dorongold.plugins:task-tree:1.3.1.
> Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/com/dorongold/plugins/task-tree/1.3.1/task-tree-1.3.1.pom'.
> Could not GET 'https://plugins.gradle.org/m2/gradle/plugin/com/dorongold/plugins/task-tree/1.3.1/task-tree-1.3.1.pom'.
> sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
Could not resolve gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6.
Required by:
project :
> Could not resolve gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6.
> Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/com/github/sherter/google-java-format/google-java-format-gradle-plugin/0.6/google-java-format-gradle-plugin-0.6.pom'.
> Could not GET 'https://plugins.gradle.org/m2/gradle/plugin/com/github/sherter/google-java-format/google-java-format-gradle-plugin/0.6/google-java-format-gradle-plugin-0.6.pom'.
> sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
try { | ||
callable.call(1); | ||
Assert.fail("Callable should have thrown an exception"); | ||
} catch (Exception expected) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeException or something more specific. Other exceptions can still cause the test to fail.
removed deprecated `ExpectedException.none()` usage across unit test cases. chore: address feedback comments
@elharo I am really sorry for this stale PR. Until last week it's Java 7 presubmit job was failing, finally its green now. Would you please have another look, I addressed your previous feedback comments. |
@@ -29,27 +29,26 @@ | |||
*/ | |||
package com.google.api.gax.grpc; | |||
|
|||
import static com.google.common.truth.Truth.assertThat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't static import this since there are at least three different assertThat's this could be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the recommended way to use Truth?
https://truth.dev/#2-add-static-imports-for-truths-entry-points
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actively disagree with that recommendation. I like to know where my methods come from. In this case I was about to send you a completely wrong review because I assumed it was a different assertThat()
method than it actually was. As I said, there are at least three in common use. Removing ambiguity is important for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elharo Thanks for the review!!
I have removed static Truth.assertThat
import introduced in this PR, Please have another look.
@@ -29,6 +29,8 @@ | |||
*/ | |||
package com.google.api.gax.httpjson; | |||
|
|||
import static com.google.common.truth.Truth.assertThat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't static import this since there are at least three different assertThat's this could be
@@ -29,28 +29,25 @@ | |||
*/ | |||
package com.google.api.gax.rpc; | |||
|
|||
import com.google.common.truth.Truth; | |||
import static com.google.common.truth.Truth.assertThat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't static import this since there are at least three different assertThat's this could be
@@ -29,6 +29,8 @@ | |||
*/ | |||
package com.google.api.gax.rpc; | |||
|
|||
import static com.google.common.truth.Truth.assertThat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't static import this since there are at least three different assertThat's this could be
Fixes #857
removed deprecated ExpectedException.none() usage across unit test cases.