private void checkingLibJarName(String jarName, String libPrefix) throws Exception {
    File tmpFolder = new File(ClassLoaderTestHelper.localDirPath(conf), "tmp");
    if (tmpFolder.exists()) { // Clean up the tmp folder
      File[] files = tmpFolder.listFiles();
      if (files != null) {
        for (File f : files) {
          f.delete();
        }
      }
    }
    String className = "CheckingLibJarName";
    String folder = TEST_UTIL.getDataTestDir().toString();
    File innerJarFile = ClassLoaderTestHelper.buildJar(folder, className, null,
      ClassLoaderTestHelper.localDirPath(conf));
    File targetJarFile = new File(innerJarFile.getParent(), jarName);
    ClassLoaderTestHelper.addJarFilesToJar(targetJarFile, libPrefix, innerJarFile);
    Path path = new Path(targetJarFile.getAbsolutePath());
    ClassLoader parent = TestCoprocessorClassLoader.class.getClassLoader();
    ClassLoader classLoader = CoprocessorClassLoader.getClassLoader(path, parent, "112", conf);
    assertNotNull("Classloader should be created", classLoader);
    String fileToLookFor = "." + className + ".jar";
    String[] files = tmpFolder.list();
    if (files != null) {
      for (String f : files) {
        if (f.endsWith(fileToLookFor) && f.contains(jarName)) {
          // Cool, found it;
          return;
        }
      }
    }
    fail("Could not find the expected lib jar file");
  }
Test to make sure the lib jar file extracted from a coprocessor jar have the right name.
Otherwise, some existing jar could be override if there are naming conflicts.
hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorClassLoader.java