Copilot commented on code in PR #6110:
URL: https://github.com/apache/fineract/pull/6110#discussion_r3550156879


##########
fineract-provider/src/test/java/org/apache/fineract/portfolio/client/ClientCrossFeatureBoundaryTest.java:
##########
@@ -0,0 +1,136 @@
+/**
+ * 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.fineract.portfolio.client;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.tngtech.archunit.core.domain.JavaClass;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.junit.jupiter.api.Test;
+import org.springframework.modulith.core.ApplicationModule;
+import org.springframework.modulith.core.ApplicationModuleDependency;
+import org.springframework.modulith.core.ApplicationModules;
+
+class ClientCrossFeatureBoundaryTest {
+
+    private static final String BASE = "org.apache.fineract";
+    private static final String CLIENT_PACKAGE = 
"org.apache.fineract.portfolio.client";
+
+    private static final Set<String> FOUNDATION_ARTIFACTS = 
Set.of("fineract-core", "fineract-command");
+
+    private static final Pattern FINERACT_ARTIFACT = 
Pattern.compile("fineract-[a-z0-9-]+");
+
+    private static ApplicationModules modules;
+
+    private static ApplicationModules modules() {
+        if (modules == null) {
+            modules = ApplicationModules.of(BASE);
+        }
+        return modules;
+    }
+
+    private static ApplicationModule clientModule() {
+        return modules().stream() //
+                .filter(module -> 
module.getBasePackage().getName().equals(CLIENT_PACKAGE)) //
+                .findFirst() //
+                .orElseThrow(() -> new IllegalStateException("Client module 
not found in the model"));
+    }
+
+    private static String featureKey(String typeName) {
+        String prefix = BASE + ".";
+        if (!typeName.startsWith(prefix)) {
+            return typeName;
+        }
+        String[] parts = typeName.substring(prefix.length()).split("\\.");
+        return parts.length >= 2 ? parts[0] + "." + parts[1] : parts[0];
+    }
+
+    private static String owningArtifact(JavaClass type) {
+        return type.getSource() //
+                .map(source -> source.getUri().toString()) //
+                .map(uri -> {
+                    Matcher matcher = FINERACT_ARTIFACT.matcher(uri);
+                    return matcher.find() ? matcher.group() : uri;
+                }) //
+                .orElse("(unknown-source)");
+    }
+
+    private static boolean isFoundation(JavaClass type) {
+        return type.getSource() //
+                .map(source -> source.getUri().toString()) //
+                .map(uri -> 
FOUNDATION_ARTIFACTS.stream().anyMatch(uri::contains)) //
+                .orElse(false);
+    }
+
+    @Test
+    void printClientCrossFeatureDependencyReport() {

Review Comment:
   This test method only prints a report to stdout and performs no assertions, 
which adds runtime/log noise to CI while always passing. Consider disabling it 
by default and enabling locally when needed.



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