nastra commented on code in PR #7116:
URL: https://github.com/apache/iceberg/pull/7116#discussion_r1138252705
##########
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSOutputFile.java:
##########
@@ -63,11 +63,11 @@ public void testWriteFile() throws IOException {
@Test
public void testFromLocation() {
- AssertHelpers.assertThrows(
- "Should catch null location when creating oss output file",
- NullPointerException.class,
- "location cannot be null",
- () -> OSSOutputFile.fromLocation(ossClient, null, aliyunProperties));
+ Assertions.assertThatThrownBy(
+ () -> OSSOutputFile.fromLocation(ossClient, null,
aliyunProperties),
+ "Should catch null location when creating oss output file")
Review Comment:
same here regarding the description part. I don't think it adds any value
keeping it
##########
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSInputFile.java:
##########
@@ -61,13 +61,13 @@ public void testReadFile() throws Exception {
@Test
public void testOSSInputFile() {
OSSURI uri = randomURI();
- AssertHelpers.assertThrows(
- "File length should not be negative",
- ValidationException.class,
- "Invalid file length",
- () ->
- new OSSInputFile(
- ossClient().get(), uri, aliyunProperties, -1,
MetricsContext.nullMetrics()));
+ Assertions.assertThatThrownBy(
+ () ->
+ new OSSInputFile(
+ ossClient().get(), uri, aliyunProperties, -1,
MetricsContext.nullMetrics()),
+ "File length should not be negative")
Review Comment:
nit: I would probably remove the description `File length should not be
negative` from here as it doesn't add any value. However in other places in the
codebase the description might be useful.
Going forward it would be good to double-check if having the description
makes sense
##########
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSURI.java:
##########
@@ -49,47 +49,46 @@ public void testEncodedString() {
@Test
public void invalidBucket() {
Review Comment:
we can omit the description in all of the changes in this class
##########
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSURI.java:
##########
@@ -49,47 +49,46 @@ public void testEncodedString() {
@Test
public void invalidBucket() {
- AssertHelpers.assertThrows(
- "Invalid bucket",
- IllegalArgumentException.class,
- OSS_RESOURCE_MANAGER.getFormattedString("BucketNameInvalid",
"test_bucket"),
- () -> new OSSURI("https://test_bucket/path/to/file"));
+
+ Assertions.assertThatThrownBy(
+ () -> new OSSURI("https://test_bucket/path/to/file"), "Invalid
bucket")
Review Comment:
same as above
--
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]