Conversation
|
|
||
| @RunWith(JUnit4.class) | ||
| public class TimeoutTest { | ||
| @ExtendWith(MockitoExtension.class) |
There was a problem hiding this comment.
Because there is a @Rule for Mockito being removed below.
gax-java/gax/src/test/java/com/google/api/gax/batching/ThresholdBatcherTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/batching/ThresholdBatcherTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/batching/ThresholdBatcherTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/ApiExceptionsTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/ApiExceptionsTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/ApiExceptionsTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchedRequestIssuerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchedRequestIssuerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchedRequestIssuerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchedRequestIssuerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchingTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/BatchingTest.java
Outdated
Show resolved
Hide resolved
...a/gax/src/test/java/com/google/api/gax/rpc/internal/QuotaProjectIdHidingCredentialsTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/mtls/AbstractMtlsTransportChannelTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/mtls/MtlsProviderTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/mtls/MtlsProviderTest.java
Outdated
Show resolved
Hide resolved
gax-java/pom.xml
Outdated
| <version>4.13.2</version> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-core</artifactId> | ||
| <version>4.11.0</version> |
There was a problem hiding this comment.
Why not using mockito bom?
There was a problem hiding this comment.
I was not aware of a mockito bom, sounds like a good idea. Also, I think adding the bom to this pom should fine, because gax-parent is not included in the gapic-generator-java-bom, only gax-bom is. Is that correct?
There was a problem hiding this comment.
Yes, I think so.
You can verify this by running mvn -pl gapic-generator-java-bom help:effective-pom at repo root.
gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java
Show resolved
Hide resolved
gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcDirectStreamControllerTest.java
Outdated
Show resolved
Hide resolved
|
|
This PR migrate all unit tests in Gax to Junit 5. Other than standard direct replacements, some tests need to be rewritten due to the following scenarios: - `@Rule` does not exist anymore and there is no direct replacement. We mostly use it to initialize a Mockito stub, replaced with `@ExtendWith(MockitoExtension.class)`. - Some tests were relying on try-catch to assert exceptions, replaced with `assertThrows`. e.g. [OperationsClientTest](https://github.com/googleapis/sdk-platform-java/pull/2724/files#diff-4530df761eff0854357165d951e1667d3810a5448ec2aa4b853a6331516cbde0) - Parameterized tests in [AbstractRetryingExecutorTest](https://github.com/googleapis/sdk-platform-java/pull/2724/files#diff-9c5f5c1d2fcef6c4164fc0171d01e7020aa7ebb7aa49615cf3743dc89c9b3d1d) There are a few environment variable tests can be re-written with Junit 5, so we don't need to configure a [profile](https://github.com/googleapis/sdk-platform-java/blob/main/gax-java/gax/pom.xml#L115-L128) for it anymore, but they are not in the scope of this PR. fixes: #1611.




This PR migrate all unit tests in Gax to Junit 5.
Other than standard direct replacements, some tests need to be rewritten due to the following scenarios:
@Ruledoes not exist anymore and there is no direct replacement. We mostly use it to initialize a Mockito stub, replaced with@ExtendWith(MockitoExtension.class).assertThrows. e.g. OperationsClientTestThere are a few environment variable tests can be re-written with Junit 5, so we don't need to configure a profile for it anymore, but they are not in the scope of this PR.
fixes: #1611.