AgentPackageService { protected boolean isDependentLib(File libFile, Set<String> libs) { if (libFile.getName().contains("grinder-3.9.1.jar")) { return false; } String name = replaceLast(libFile.getName(), "-[a-zA-Z][a-zA-Z1-9]+\\.", "."); final int libVersionStartIndex = name.lastIndexOf("-"); name = name.substring(0, (libVersionStartIndex == -1) ? name.lastIndexOf(".") : libVersionStartIndex); return libs.contains(name); }  File createPackage(PackageHandler packageHandler, URLClassLoader classLoader, String regionName, String connectionIP, int port, String owner); File createAgentPackage(); File createAgentPackage(String region, String connectionIP, int port, String owner); boolean isJar(File libFile);  }
@Test public void testIsDependentLib() { Set<String> libs = new HashSet<>(); libs.add("ngrinder-groovy"); libs.add("ngrinder-core"); libs.add("ngrinder-runtime"); libs.add("javassist"); libs.add("jna"); libs.add("jboss-transaction-api_1.2_spec"); assertTrue(agentPackageService.isDependentLib(new File("ngrinder-core-3.5.1-SNAPSHOT.jar"), libs)); assertTrue(agentPackageService.isDependentLib(new File("ngrinder-groovy-3.5.1.jar"), libs)); assertTrue(agentPackageService.isDependentLib(new File("ngrinder-runtime-3.5.1-p4.jar"), libs)); assertTrue(agentPackageService.isDependentLib(new File("javassist-3.24.0-GA.jar"), libs)); assertTrue(agentPackageService.isDependentLib(new File("jna-5.6.0.jar"), libs)); assertTrue(agentPackageService.isDependentLib(new File("jboss-transaction-api_1.2_spec-1.1.1.Final.jar"), libs)); assertFalse(agentPackageService.isDependentLib(new File("jcommander-1.32.jar"), libs)); assertFalse(agentPackageService.isDependentLib(new File("commons-collections-3.2.1.jar"), libs)); }