Abyss-lord commented on code in PR #7354:
URL: https://github.com/apache/gravitino/pull/7354#discussion_r2136868707


##########
core/src/test/java/org/apache/gravitino/utils/TestUtil.java:
##########
@@ -0,0 +1,518 @@
+/*
+ * 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.gravitino.utils;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.authorization.Privileges;
+import org.apache.gravitino.authorization.SecurableObject;
+import org.apache.gravitino.file.Fileset;
+import org.apache.gravitino.meta.AuditInfo;
+import org.apache.gravitino.meta.BaseMetalake;
+import org.apache.gravitino.meta.CatalogEntity;
+import org.apache.gravitino.meta.ColumnEntity;
+import org.apache.gravitino.meta.FilesetEntity;
+import org.apache.gravitino.meta.GroupEntity;
+import org.apache.gravitino.meta.ModelEntity;
+import org.apache.gravitino.meta.ModelVersionEntity;
+import org.apache.gravitino.meta.RoleEntity;
+import org.apache.gravitino.meta.SchemaEntity;
+import org.apache.gravitino.meta.SchemaVersion;
+import org.apache.gravitino.meta.TableEntity;
+import org.apache.gravitino.meta.TagEntity;
+import org.apache.gravitino.meta.TopicEntity;
+import org.apache.gravitino.meta.UserEntity;
+import org.apache.gravitino.rel.types.Types;
+import org.apache.gravitino.storage.RandomIdGenerator;
+
+/**
+ * Utility class providing factory methods for creating mock and test 
instances of various metadata
+ * entities used in unit tests.
+ *
+ * <p>This class includes shortcut methods for constructing entities such as 
{@link BaseMetalake},
+ * {@link CatalogEntity}, {@link SchemaEntity}, {@link TableEntity}, {@link 
ModelEntity}, {@link
+ * FilesetEntity}, {@link TopicEntity}, {@link TagEntity}, {@link UserEntity}, 
{@link GroupEntity},
+ * {@link RoleEntity}, and {@link ModelVersionEntity}. It also includes 
methods to create mock
+ * {@link ColumnEntity} and {@link SecurableObject} instances for use in 
mocking behavior-dependent
+ * components.
+ *
+ * <p>These utilities are intended for testing purposes only and rely on 
in-memory mock objects or
+ * randomly generated IDs to simulate real entities.
+ *
+ * <p>Note: This class is not thread-safe.
+ */
+public class TestUtil {
+  // Random ID generator used to generate IDs for test entities.
+  private static RandomIdGenerator generator = new RandomIdGenerator();
+
+  /**
+   * Returns a list of given iterable instance.
+   *
+   * @param iterable The iterable instance to convert to a list.
+   * @return A list of the elements in the iterable.
+   * @param <T> The type of the elements in the iterable.
+   */
+  public static <T> List<T> toList(Iterable<T> iterable) {

Review Comment:
   Thanks for the suggestion! This method is actually not used in the current 
context, so I've decided to remove it to avoid confusion. Appreciate your input 
as always.



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

Reply via email to