You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "advancedxy (via GitHub)" <gi...@apache.org> on 2024/06/03 06:42:11 UTC

[PR] Parquet,API: Consolidate Parquet's TestHelpers into API module [iceberg]

advancedxy opened a new pull request, #10428:
URL: https://github.com/apache/iceberg/pull/10428

   Due to a gradle [issue](https://github.com/gradle/gradle/issues/21255), we should consolidate test classes with the same full-qualified class name.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Parquet: Remove deprecated TestHelpers in parquet module [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra merged PR #10428:
URL: https://github.com/apache/iceberg/pull/10428


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Parquet,API: Consolidate Parquet's TestHelpers into API module [iceberg]

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #10428:
URL: https://github.com/apache/iceberg/pull/10428#discussion_r1624488840


##########
api/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -173,6 +176,26 @@ public static void assertSameSchemaMap(Map<Integer, Schema> map1, Map<Integer, S
         });
   }
 
+  /**
+   * A convenience method to avoid a large number of @Test(expected=...) tests
+   *
+   * @param message A String message to describe this assertion
+   * @param expected An Exception class that the Runnable should throw
+   * @param containedInMessage A String that should be contained by the thrown exception's message
+   * @param callable A Callable that is expected to throw the exception
+   */
+  public static void assertThrows(

Review Comment:
   Thanks. Let me replace these occurrences then.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Parquet,API: Consolidate Parquet's TestHelpers into API module [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #10428:
URL: https://github.com/apache/iceberg/pull/10428#discussion_r1624384991


##########
api/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -173,6 +176,26 @@ public static void assertSameSchemaMap(Map<Integer, Schema> map1, Map<Integer, S
         });
   }
 
+  /**
+   * A convenience method to avoid a large number of @Test(expected=...) tests
+   *
+   * @param message A String message to describe this assertion
+   * @param expected An Exception class that the Runnable should throw
+   * @param containedInMessage A String that should be contained by the thrown exception's message
+   * @param callable A Callable that is expected to throw the exception
+   */
+  public static void assertThrows(

Review Comment:
   +1 on removing `TestHelpers` from `parquet`. I'd suggest to use `assertThatThrownBy(callable::call).as(message).isInstanceOf(expected).hasMessageContaining(..)` directly in the few places where it's needed rather than introducing this method. Code like this already exists in `AssertHelpers`, which is deprecated. Thus, we don't want to introduce similar code in `TestHelpers`, because using AssertJ assertions directly just provides greater flexibility with testing



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Parquet,API: Consolidate Parquet's TestHelpers into API module [iceberg]

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #10428:
URL: https://github.com/apache/iceberg/pull/10428#discussion_r1623856535


##########
parquet/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iceberg;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import java.util.concurrent.Callable;
-import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.generic.GenericRecord;
-import org.assertj.core.api.AbstractThrowableAssert;
-
-public class TestHelpers {
-
-  private TestHelpers() {}
-
-  /**
-   * A convenience method to avoid a large number of @Test(expected=...) tests
-   *
-   * @param message A String message to describe this assertion
-   * @param expected An Exception class that the Runnable should throw
-   * @param containedInMessage A String that should be contained by the thrown exception's message
-   * @param callable A Callable that is expected to throw the exception
-   */
-  public static void assertThrows(
-      String message,
-      Class<? extends Exception> expected,
-      String containedInMessage,
-      Callable callable) {
-    AbstractThrowableAssert<?, ? extends Throwable> check =
-        assertThatThrownBy(callable::call).as(message).isInstanceOf(expected);
-    if (null != containedInMessage) {
-      check.hasMessageContaining(containedInMessage);
-    }
-  }
-
-  /**
-   * A convenience method to avoid a large number of @Test(expected=...) tests
-   *
-   * @param message A String message to describe this assertion
-   * @param expected An Exception class that the Runnable should throw
-   * @param containedInMessage A String that should be contained by the thrown exception's message
-   * @param runnable A Runnable that is expected to throw the runtime exception
-   */
-  public static void assertThrows(
-      String message,
-      Class<? extends Exception> expected,
-      String containedInMessage,
-      Runnable runnable) {
-    AbstractThrowableAssert<?, ? extends Throwable> check =
-        assertThatThrownBy(runnable::run).as(message).isInstanceOf(expected);
-    if (null != containedInMessage) {
-      check.hasMessageContaining(containedInMessage);
-    }
-  }
-
-  /**
-   * A convenience method to assert if an Avro field is empty
-   *
-   * @param record The record to read from
-   * @param field The name of the field
-   */
-  public static void assertEmptyAvroField(GenericRecord record, String field) {

Review Comment:
   These two methods are not used by any other places.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org