// Path: dexopener/src/test/java/test/MyClass.java
// public class MyClass {
// }


import android.content.Context;
import android.content.pm.ApplicationInfo;
import com.github.tmurakami.dexopener.repackaged.com.google.common.base.Predicate;
import org.jf.dexlib2.Opcodes;
import org.jf.dexlib2.immutable.ImmutableClassDef;
import org.jf.dexlib2.immutable.ImmutableDexFile;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.RunnableFuture;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import test.MyClass;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.mockito.AdditionalAnswers.answer;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.withSettings;
        given(context.getApplicationInfo()).willReturn(ai);
        ai.dataDir = folder.newFolder().getCanonicalPath();
        int classCount = 101; // MAX_CLASSES_PER_DEX_FILE + 1
        List<String> classNames = new ArrayList<>(classCount);
        for (int i = 0; i < classCount; i++) {
            classNames.add("foo.Bar" + i);
        }
        Set<ImmutableClassDef> classes = new HashSet<>();
        for (String className : classNames) {
            classes.add(new ImmutableClassDef('L' + className.replace('.', '/') + ';', 0,
                                              null, null, null, null, null, null));
        }
        ImmutableDexFile dexFile = new ImmutableDexFile(Opcodes.getDefault(), classes);
        File zip = folder.newFile();
        try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip))) {
            out.putNextEntry(new ZipEntry("classes.dex"));
            out.write(DexPoolUtils.toBytecode(dexFile));
        }
        ai.sourceDir = zip.getCanonicalPath();
        ClassLoader loader = new ClassLoader() {
        };
        given(dexFileLoader.loadDex(anyString(), anyString()))
                .will(answer((src, out) -> {
                    dalvik.system.DexFile file = mock(dalvik.system.DexFile.class,
                                                      withSettings().stubOnly());
                    given(file.loadClass(anyString(), eq(loader))).willReturn(MyClass.class);
                    return file;
                }));
        ClassPath classPath = new ClassPath(context, classNameFilter, dexFileLoader, executor);
        for (String className : classNames) {
// Path: dexopener/src/test/java/test/MyClass.java
// public class MyClass {
// }


// Path: dexopener/src/test/java/com/github/tmurakami/dexopener/ClassPathTest.java
import android.content.Context;
import android.content.pm.ApplicationInfo;
import com.github.tmurakami.dexopener.repackaged.com.google.common.base.Predicate;
import org.jf.dexlib2.Opcodes;
import org.jf.dexlib2.immutable.ImmutableClassDef;
import org.jf.dexlib2.immutable.ImmutableDexFile;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.RunnableFuture;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import test.MyClass;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.mockito.AdditionalAnswers.answer;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.withSettings;

        given(context.getApplicationInfo()).willReturn(ai);
        ai.dataDir = folder.newFolder().getCanonicalPath();
        int classCount = 101; // MAX_CLASSES_PER_DEX_FILE + 1
        List<String> classNames = new ArrayList<>(classCount);
        for (int i = 0; i < classCount; i++) {
            classNames.add("foo.Bar" + i);
        }
        Set<ImmutableClassDef> classes = new HashSet<>();
        for (String className : classNames) {
            classes.add(new ImmutableClassDef('L' + className.replace('.', '/') + ';', 0,
                                              null, null, null, null, null, null));
        }
        ImmutableDexFile dexFile = new ImmutableDexFile(Opcodes.getDefault(), classes);
        File zip = folder.newFile();
        try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip))) {
            out.putNextEntry(new ZipEntry("classes.dex"));
            out.write(DexPoolUtils.toBytecode(dexFile));
        }
        ai.sourceDir = zip.getCanonicalPath();
        ClassLoader loader = new ClassLoader() {
        };
        given(dexFileLoader.loadDex(anyString(), anyString()))
                .will(answer((src, out) -> {
                    dalvik.system.DexFile file = mock(dalvik.system.DexFile.class,
                                                      withSettings().stubOnly());
                    given(file.loadClass(anyString(), eq(loader))).willReturn(MyClass.class);
                    return file;
                }));
        ClassPath classPath = new ClassPath(context, classNameFilter, dexFileLoader, executor);
        for (String className : classNames) {
            assertSame(MyClass.class, classPath.loadClass(className, loader));