Skip to content

Commit

Permalink
Fix previous commit: make the test result independent of the state of…
Browse files Browse the repository at this point in the history
… the build
  • Loading branch information
carlosame committed May 10, 2024
1 parent 460ae3c commit 6c1bac6
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package io.sf.carte.echosvg.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.io.IOException;
Expand All @@ -42,18 +42,19 @@ public class ClassFileUtilitiesTest {
@Test
public void testCollectJars() throws Exception {
URL url = new URL(TestLocations.PROJECT_ROOT_URL);
collectJarsTest(url.getFile() + "test-resources/io/sf/carte/echosvg/bridge", 4, 6);
collectJarsTest(url.getFile() + "test-resources/io/sf/carte/echosvg/bridge", 2, 2);
}

private void collectJarsTest(String dir, int jarCount, int classCount)
private void collectJarsTest(String dir, int minJarCount, int minClassCount)
throws SecurityException, IOException {
File f = new File(dir);
Map<String, Jar> jars = new HashMap<>();
Map<String, ClassFile> classFiles = new HashMap<>();
ClassFileUtilities.collectJars(f, jars, classFiles);

assertEquals(jarCount, jars.size());
assertEquals(classCount, classFiles.size());
assertTrue(minJarCount <= jars.size(), "Found less than " + minJarCount + " jar files.");
assertTrue(minClassCount <= classFiles.size(),
"Found less than " + minClassCount + " class files.");
}

}

0 comments on commit 6c1bac6

Please sign in to comment.