You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by et...@apache.org on 2024/08/05 15:26:38 UTC

(iceberg) branch replace-assert-usage created (now 364a5fa5f6)

This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a change to branch replace-assert-usage
in repository https://gitbox.apache.org/repos/asf/iceberg.git


      at 364a5fa5f6 Aliyun: Replace assert usage with assertThat

This branch includes the following new commits:

     new 364a5fa5f6 Aliyun: Replace assert usage with assertThat

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iceberg) 01/01: Aliyun: Replace assert usage with assertThat

Posted by et...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch replace-assert-usage
in repository https://gitbox.apache.org/repos/asf/iceberg.git

commit 364a5fa5f6dc66be2a17a7391d76c227368d9605
Author: Eduard Tudenhoefner <et...@gmail.com>
AuthorDate: Mon Aug 5 17:26:29 2024 +0200

    Aliyun: Replace assert usage with assertThat
---
 .../aliyun/oss/mock/AliyunOSSMockLocalStore.java       | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/AliyunOSSMockLocalStore.java b/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/AliyunOSSMockLocalStore.java
index 499e61495f..f7a4b72e4b 100644
--- a/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/AliyunOSSMockLocalStore.java
+++ b/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/AliyunOSSMockLocalStore.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.aliyun.oss.mock;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.aliyun.oss.OSSErrorCode;
 import com.aliyun.oss.model.Bucket;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -137,7 +139,9 @@ public class AliyunOSSMockLocalStore {
       Map<String, String> userMetaData)
       throws IOException {
     File bucketDir = new File(root, bucketName);
-    assert bucketDir.exists() || bucketDir.mkdirs();
+    assertThat(bucketDir)
+        .satisfiesAnyOf(
+            bucket -> assertThat(bucket).exists(), bucket -> assertThat(bucket.mkdirs()).isTrue());
 
     File dataFile = new File(bucketDir, fileName + DATA_FILE);
     File metaFile = new File(bucketDir, fileName + META_FILE);
@@ -170,17 +174,21 @@ public class AliyunOSSMockLocalStore {
 
   void deleteObject(String bucketName, String filename) {
     File bucketDir = new File(root, bucketName);
-    assert bucketDir.exists();
+    assertThat(bucketDir).exists();
 
     File dataFile = new File(bucketDir, filename + DATA_FILE);
     File metaFile = new File(bucketDir, filename + META_FILE);
-    assert !dataFile.exists() || dataFile.delete();
-    assert !metaFile.exists() || metaFile.delete();
+    assertThat(dataFile)
+        .satisfiesAnyOf(
+            file -> assertThat(file).doesNotExist(), file -> assertThat(file.delete()).isTrue());
+    assertThat(metaFile)
+        .satisfiesAnyOf(
+            file -> assertThat(file).doesNotExist(), file -> assertThat(file.delete()).isTrue());
   }
 
   ObjectMetadata getObjectMetadata(String bucketName, String filename) throws IOException {
     File bucketDir = new File(root, bucketName);
-    assert bucketDir.exists();
+    assertThat(bucketDir).exists();
 
     File dataFile = new File(bucketDir, filename + DATA_FILE);
     if (!dataFile.exists()) {