nastra commented on code in PR #7666:
URL: https://github.com/apache/iceberg/pull/7666#discussion_r1205738761
##########
api/src/test/java/org/apache/iceberg/TestIcebergBuild.java:
##########
@@ -18,33 +18,40 @@
*/
package org.apache.iceberg;
+import static org.assertj.core.api.Assertions.assertThat;
+
import java.util.Locale;
import java.util.regex.Pattern;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestIcebergBuild {
@Test
public void testFullVersion() {
- Assert.assertEquals(
- "Should build full version from version and commit ID",
- "Apache Iceberg " + IcebergBuild.version() + " (commit " +
IcebergBuild.gitCommitId() + ")",
- IcebergBuild.fullVersion());
+ assertThat(IcebergBuild.fullVersion())
+ .as("Should build full version from version and commit ID")
+ .isEqualTo(
+ "Apache Iceberg "
+ + IcebergBuild.version()
+ + " (commit "
+ + IcebergBuild.gitCommitId()
+ + ")");
}
@Test
public void testVersion() {
- Assert.assertNotEquals("Should not use unknown version", "unknown",
IcebergBuild.version());
+ assertThat(IcebergBuild.version()).as("Should not use unknown
version").isNotEqualTo("unknown");
}
@Test
public void testGitCommitId() {
- Assert.assertNotEquals(
- "Should not use unknown commit ID", "unknown",
IcebergBuild.gitCommitId());
- Assert.assertTrue(
- "Should be a hexadecimal string of 20 bytes",
- Pattern.compile("[0-9a-f]{40}")
- .matcher(IcebergBuild.gitCommitId().toLowerCase(Locale.ROOT))
- .matches());
+ assertThat(IcebergBuild.gitCommitId())
+ .as("Should not use unknown commit ID")
+ .isNotEqualTo("unknown");
+ assertThat(
+ Pattern.compile("[0-9a-f]{40}")
+ .matcher(IcebergBuild.gitCommitId().toLowerCase(Locale.ROOT))
+ .matches())
+ .as("Should be a hexadecimal string of 20 bytes")
+ .isTrue();
Review Comment:
rather than `isTrue()` we can change this to
```
assertThat(
Pattern.compile("[0-9a-f]{40}")
.matcher(IcebergBuild.gitCommitId().toLowerCase(Locale.ROOT)))
.as("Should be a hexadecimal string of 20 bytes")
.matches();
```
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableGroup.java:
##########
@@ -91,7 +92,7 @@ public void notSuppressExceptionIfSetSuppressIsFalse() throws
Exception {
closeableGroup.addCloseable(closeable2);
closeableGroup.addCloseable(closeable3);
-
Assertions.assertThatThrownBy(closeableGroup::close).isEqualTo(ioException);
+ assertThatThrownBy(closeableGroup::close).isEqualTo(ioException);
Review Comment:
do we really need these changes? It just adds unnecessary overhead when
reviewing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]