fix(java): Use Junit.assert instead of Hamcrest to fix Native Image testing#1746
fix(java): Use Junit.assert instead of Hamcrest to fix Native Image testing#1746
Conversation
ansh0l
left a comment
There was a problem hiding this comment.
lgtm, Since this is a change of just the assertion library. Adding a do not merge label since we intend to merge all the native image related PRs in a single go.
| import static org.hamcrest.CoreMatchers.startsWith; | ||
| import static org.hamcrest.MatcherAssert.assertThat; | ||
| import static com.google.common.truth.Truth.assertThat; | ||
| import static com.google.common.truth.Truth.assertWithMessage; |
There was a problem hiding this comment.
@mpeddada1 I'm trying to understand the import for Truth: https://github.com/googleapis/java-spanner/blob/aac438e02e841c6ee44362f5f319505d0264ceda/google-cloud-spanner/pom.xml, but can't find it. Can you point me to the right pom?
There was a problem hiding this comment.
Is this you're looking for?
java-spanner/google-cloud-spanner/pom.xml
Line 315 in aac438e
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<scope>test</scope>
</dependency>
|
Closing since native image changes have been released with #1878 |
|
Closing since native image changes have been released with #1878 |
This PR is needed to address failures related to Native Image compilation.
Calling
mvn test -Dtest=com.google.cloud.spanner.connection.it.ITQueryOptionsTest -Pnative -DfailIfNoTests=falselocally results in the following error:GraalVM isn't able to handle more complex assertions in Hamcrest such as
assertThat().startsWith()andassertThat().contains(). The Truth framework and Junit, on the other hand, are compatible.cc @ansh0l @meltsufin