vidakovic commented on a change in pull request #2137:
URL: https://github.com/apache/fineract/pull/2137#discussion_r824891951



##########
File path: 
fineract-provider/src/test/java/org/apache/fineract/infrastructure/classpath/ClasspathDuplicatesScenario.java
##########
@@ -16,84 +16,64 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.classdupes;
+package org.apache.fineract.infrastructure.classpath;
 
+import io.cucumber.java8.En;
 import io.github.classgraph.ClassGraph;
 import io.github.classgraph.ResourceList;
 import io.github.classgraph.ScanResult;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
+import org.opentest4j.AssertionFailedError;
 
-/**
- * Check classpath for duplicates.
- *
- * @author Michael Vorburger.ch
- */
-public class ClasspathHellDuplicatesChecker {
-
-    public static final ClasspathHellDuplicatesChecker INSTANCE = new 
ClasspathHellDuplicatesChecker();
-
-    private final Map<String, List<String>> duplicates;
-
-    public ClasspathHellDuplicatesChecker() {
-        duplicates = recheck();
-    }
+public class ClasspathDuplicatesScenario implements En {
 
-    public Map<String, List<String>> getDuplicates() {
-        return duplicates;
-    }
+    private Map<String, List<String>> duplicates = new HashMap<>();
 
-    public String toString(Map<String, List<String>> map) {
-        StringBuilder sb = new StringBuilder();
-        for (Map.Entry<String, List<String>> entry : map.entrySet()) {
-            sb.append(entry.getKey());
-            sb.append('\n');
-            for (String location : entry.getValue()) {
-                sb.append("    ");
-                sb.append(location);
-                sb.append('\n');
-            }
-        }
-        return sb.toString();
-    }
+    public ClasspathDuplicatesScenario() {
+        Given("A classpath", () -> {
+            // nothing to do here
+        });
 
-    private Map<String, List<String>> recheck() {
-        Map<String, List<String>> dupes = new HashMap<>();
-        // To debug this scanner, use ClassGraph().verbose()
-        // We intentionally do not use .classFilesOnly(), or
-        // .nonClassFilesOnly(), to check both
-        try (ScanResult scanResult = new ClassGraph().scan()) {
-            for (Map.Entry<String, ResourceList> dupe : 
scanResult.getAllResources().findDuplicatePaths()) {
-                String resourceName = dupe.getKey();
-                if (!isHarmlessDuplicate(resourceName)) {
-                    boolean addIt = true;
-                    List<String> jars = dupe.getValue().stream().map(resource 
-> resource.getURL().toExternalForm())
-                            .collect(Collectors.toList());
-                    for (String jar : jars) {
-                        if (skipJAR(jar)) {
-                            addIt = false;
-                            break;
+        When("The user scans the classpath", () -> {
+            // nothing to do here

Review comment:
       Fixed




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