jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1795048 - /jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java
Date Sat, 13 May 2017 10:43:19 GMT
Author: fschumacher
Date: Sat May 13 10:43:19 2017
New Revision: 1795048

URL: http://svn.apache.org/viewvc?rev=1795048&view=rev
Log:
Try to correct test case, when first jar has no annotations.

Modified:
    jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java

Modified: jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java?rev=1795048&r1=1795047&r2=1795048&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java (original)
+++ jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java Sat May 13 10:43:19
2017
@@ -102,11 +102,15 @@ public class TestClassFinder {
 
     @Test
     public void testFindAllClassesInJar() throws Exception {
-        Path jarPath = Files.find(Paths.get(libDirs[0]), 1, (p, a) -> String.valueOf(p).endsWith(".jar")).findFirst()
-                .orElseThrow(() -> new FileNotFoundException("no jars found")).toRealPath();
-        List<String> annotatedClasses = ClassFinder.findClasses(new String[] { jarPath.toString()
},
-                c -> true);
-        Assert.assertFalse("No classes found in: " + jarPath, annotatedClasses.isEmpty());
+        List<Path> jarsPaths = Files.find(Paths.get(libDirs[0]), 1, (p, a) -> String.valueOf(p).endsWith(".jar"))
+                .collect(Collectors.toList());
+        for (Path jarPath : jarsPaths) {
+            if (!ClassFinder.findClasses(new String[] { jarPath.toRealPath().toString() },
c -> true).isEmpty()) {
+                // ok, we found an annotated class
+                return;
+            }
+        }
+        Assert.fail("No classes found in: " + jarsPaths);
     }
 
     @Test



Mime
View raw message