### Question:
ModuleNode extends ModuleVisitor { public void accept(final ClassVisitor classVisitor) { ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.visitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.size(); i < n; i++) { moduleVisitor.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0, n = requires.size(); i < n; i++) { requires.get(i).accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.size(); i < n; i++) { exports.get(i).accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.size(); i < n; i++) { opens.get(i).accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.size(); i < n; i++) { moduleVisitor.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0, n = provides.size(); i < n; i++) { provides.get(i).accept(moduleVisitor); } } } ModuleNode(final String name, final int access, final String version);  ModuleNode(
      final int api,
      final String name,
      final int access,
      final String version,
      final List<ModuleRequireNode> requires,
      final List<ModuleExportNode> exports,
      final List<ModuleOpenNode> opens,
      final List<String> uses,
      final List<ModuleProvideNode> provides); @Override void visitMainClass(final String mainClass); @Override void visitPackage(final String packaze); @Override void visitRequire(final String module, final int access, final String version); @Override void visitExport(final String packaze, final int access, final String... modules); @Override void visitOpen(final String packaze, final int access, final String... modules); @Override void visitUse(final String service); @Override void visitProvide(final String service, final String... providers); @Override void visitEnd(); void accept(final ClassVisitor classVisitor); public String name; public int access; public String version; public String mainClass; public List<String> packages; public List<ModuleRequireNode> requires; public List<ModuleExportNode> exports; public List<ModuleOpenNode> opens; public List<String> uses; public List<ModuleProvideNode> provides; }### Answer:
@Test public void testAccept() { ModuleNode moduleNode = new ModuleNode("module", 123, "1.0"); ModuleNode dstModuleNode = new ModuleNode("", 0, ""); ClassVisitor copyModuleVisitor = new ClassVisitor( Opcodes.ASM10_EXPERIMENTAL) { @Override public ModuleVisitor visitModule( final String name, final int access, final String version) { dstModuleNode.name = name; dstModuleNode.access = access; dstModuleNode.version = version; return dstModuleNode; } }; moduleNode.accept(copyModuleVisitor); assertEquals("module", dstModuleNode.name); assertEquals(123, dstModuleNode.access); assertEquals("1.0", dstModuleNode.version); }
@Test public void testAccept() { ModuleNode moduleNode = new ModuleNode("module", 123, "1.0"); ModuleNode dstModuleNode = new ModuleNode("", 0, ""); ClassVisitor copyModuleVisitor = new ClassVisitor(Opcodes.ASM7) { @Override public ModuleVisitor visitModule( final String name, final int access, final String version) { dstModuleNode.name = name; dstModuleNode.access = access; dstModuleNode.version = version; return dstModuleNode; } }; moduleNode.accept(copyModuleVisitor); assertEquals("module", dstModuleNode.name); assertEquals(123, dstModuleNode.access); assertEquals("1.0", dstModuleNode.version); }