@@ -0,0 +1,2900 @@
+package com.github.tmurakami.dexmockito;%0A%0Aimport com.android.dx.dex.DexOptions;%0Aimport com.android.dx.dex.cf.CfOptions;%0A%0Aimport net.bytebuddy.description.type.TypeDescription;%0Aimport net.bytebuddy.utility.StreamDrainer;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.mockito.internal.util.io.IOUtil;%0Aimport org.mockito.invocation.InvocationOnMock;%0Aimport org.mockito.stubbing.Answer;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.BDDMockito.any;%0Aimport static org.mockito.BDDMockito.anyString;%0Aimport static org.mockito.BDDMockito.eq;%0Aimport static org.mockito.BDDMockito.given;%0Aimport static org.mockito.BDDMockito.mock;%0A%0Apublic class DexClassLoadingStrategyTest %7B%0A%0A    @Rule%0A    public final TemporaryFolder folder = new TemporaryFolder();%0A%0A    @Mock%0A    TypeDescription typeDescription;%0A%0A    @Mock%0A    BiFunction%3CFile, File, BiFunction%3CString, ClassLoader, Class%3E%3E dexClassLoaderFactory;%0A%0A    @Mock%0A    BiFunction%3CString, ClassLoader, Class%3E dexClassLoader;%0A%0A    private DexClassLoadingStrategy target;%0A%0A    @Before%0A    public void setUp() throws IOException %7B%0A        MockitoAnnotations.initMocks(this);%0A        target = new DexClassLoadingStrategy(new DexOptions(), new CfOptions(), folder.newFolder(), dexClassLoaderFactory);%0A    %7D%0A%0A    @Test%0A    public void testLoad() throws IOException %7B%0A        ClassLoader classLoader = getClass().getClassLoader();%0A        given(dexClassLoader.apply(anyString(), eq(classLoader))).willAnswer(new Answer%3CClass%3E() %7B%0A            @Override%0A            public Class answer(InvocationOnMock invocation) throws Throwable %7B%0A                return Class.forName(invocation.%3CString%3EgetArgument(0), false, invocation.%3CClassLoader%3EgetArgument(1));%0A            %7D%0A        %7D);%0A        given(dexClassLoaderFactory.apply(any(File.class), any(File.class))).willReturn(dexClassLoader);%0A        Map%3CTypeDescription, byte%5B%5D%3E types = new HashMap%3C%3E();%0A        Map%3CTypeDescription, Class%3E classes = new HashMap%3C%3E();%0A        for (Class%3C?%3E c : new Class%5B%5D%7BA.class, B.class, C.class%7D) %7B%0A            TypeDescription td = mock(TypeDescription.class);%0A            given(td.getName()).willReturn(c.getName());%0A            InputStream in = c.getResourceAsStream('/' + c.getName().replace('.', '/') + %22.class%22);%0A            try %7B%0A                types.put(td, StreamDrainer.DEFAULT.drain(in));%0A            %7D finally %7B%0A                IOUtil.closeQuietly(in);%0A            %7D%0A            classes.put(td, c);%0A        %7D%0A        assertEquals(classes, target.load(classLoader, types));%0A    %7D%0A%0A    private static class A %7B%0A    %7D%0A%0A    private static class B %7B%0A    %7D%0A%0A    private static class C %7B%0A    %7D%0A%0A%7D%0A

Add DexClassLoadingStrategyTest.java