reswqa commented on code in PR #7906:
URL: https://github.com/apache/iceberg/pull/7906#discussion_r1250093257


##########
common/src/main/java/org/apache/iceberg/common/testutils/PerTestCallbackWrapper.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.common.testutils;
+
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * This class is used to wrap a specific {@link CustomExtension} to junit5 
extension with test-level
+ * callbacks {@link BeforeEachCallback} and {@link AfterEachCallback}. It can 
be used as a
+ * substitute for @Rule in junit4.
+ */
+public class PerTestCallbackWrapper<C extends CustomExtension>

Review Comment:
   Thank you for your reply, but I still have some doubts:
   
   If we implement both `beforeAllCallback` and `beforeEachCallback` for 
`EcsS3MockExtension` and register it using `static` field, then both 
`beforeEach` and `beforeAll` will be invoked(`class level` and `method level` 
respectively). If it is registered using a `non-static field`, only 
`beforeEach` will be called at the `method level`. 
   
   Is my usage incorrect? Is there any way we can avoid calling `method level` 
methods during static registration (which corresponds to `@ClassRule` in 
junit4).



-- 
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]

Reply via email to