JarDiffCmd extends DiffCommand { protected void doProcessing() throws Exception { PackageMapper oldPackages = new PackageMapper(); ClassfileLoader oldJar = new AggregatingClassfileLoader(); oldJar.addLoadListener(oldPackages); List<String> old_files = new ArrayList<String>(); old_files.add(this.oldPath.toString()); oldJar.load(old_files); PackageMapper newPackages = new PackageMapper(); ClassfileLoader newJar = new AggregatingClassfileLoader(); newJar.addLoadListener(newPackages); List<String> new_files = new ArrayList<String>(); new_files.add(this.newPath.toString()); newJar.load(new_files); String name = this.oldLib.getLibId().getMvnGroup() + ":" + this.oldLib.getLibId().getArtifact(); String oldLabel = name + ":" + oldLib.getLibId().getVersion(); String newLabel = name + ":" + newLib.getLibId().getVersion(); Differences differences = getDifferencesFactory() .createProjectDifferences(name, oldLabel, oldPackages, newLabel, newPackages); visitor = new JarDiffVisitor(this.oldLib, this.newLib); differences.accept(visitor); } JarDiffCmd(Artifact _old, Path _old_path, Artifact _new, Path _new_path); JarDiffResult getResult();  }
@Test public void testDoProcessing() { Artifact old_doc = new Artifact("commons-fileupload", "commons-fileupload", "1.1.1"); Artifact new_doc = new Artifact("commons-fileupload", "commons-fileupload", "1.3.1"); Path old_jar = Paths.get("./src/test/resources/commons-fileupload-1.1.1.jar"); Path new_jar = Paths.get("./src/test/resources/commons-fileupload-1.3.1.jar"); JarDiffCmd cmd = new JarDiffCmd(old_doc, old_jar, new_doc, new_jar); try { final String[] args = new String[] { "-old", old_jar.toString(), "-new", new_jar.toString(), "-name", "xyz", "-code" }; cmd.run(args); } catch (Exception e) { e.printStackTrace(); } JarDiffResult result = cmd.getResult(); String json = JacksonUtil.asJsonString(result); System.out.println(json); assertTrue(result != null); }