├── README.md ├── mock-method-android ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── style.xml │ │ └── layout │ │ │ ├── activity_setting.xml │ │ │ ├── item_abtest_spinner.xml │ │ │ └── item_mock.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── mock │ │ └── generator │ │ ├── IMockMethodMap.java │ │ ├── config │ │ ├── IMockConfig.java │ │ └── DefaultMockConfig.java │ │ ├── MockMethodModel.java │ │ ├── MockMethodGenerator.java │ │ ├── MockMethodTransform.java │ │ ├── MockManager.java │ │ └── ui │ │ └── MockSettingActivity.java ├── build.gradle └── proguard-rules.pro ├── mock-method-plugin ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── gradle-plugins │ │ │ └── MockPlugin.properties │ │ ├── java │ │ └── com │ │ │ └── mock │ │ │ └── internel │ │ │ ├── Util.java │ │ │ ├── MockMethodModel.java │ │ │ └── JarUtils.java │ │ └── groovy │ │ └── com │ │ └── mock │ │ └── internel │ │ ├── MockExtension.groovy │ │ ├── DependencyListener.groovy │ │ ├── MockPlugin.groovy │ │ ├── MockTransform.groovy │ │ └── Inject.groovy ├── .idea │ ├── modules.xml │ ├── gradle.xml │ ├── runConfigurations.xml │ ├── codeStyles │ │ └── Project.xml │ ├── misc.xml │ └── workspace.xml ├── upload.gradle ├── local.properties └── build.gradle ├── mock-method-sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── mock │ │ │ └── sample │ │ │ └── ui │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── mock │ │ │ └── mock │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── mock │ │ └── mock │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── mock-lib └── mock-method-lib-1 │ ├── .gitignore │ ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── mock │ │ └── lib1 │ │ └── MockMethodTest.java │ ├── build.gradle │ └── proguard-rules.pro ├── screenshot ├── ic_mock_class.png ├── ic_mock_plugin.png ├── ic_mock_source.png ├── ic_screen_demo.gif ├── ic_upload_jar.jpeg └── ic_mock_annotation.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .gitmodules ├── settings.gradle ├── gradle.properties ├── debug.gradle ├── gradlew.bat └── gradlew /README.md: -------------------------------------------------------------------------------- 1 | # mock-method-sample 2 | -------------------------------------------------------------------------------- /mock-method-android/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /mock-method-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /mock-method-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /screenshot/ic_mock_class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_mock_class.png -------------------------------------------------------------------------------- /screenshot/ic_mock_plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_mock_plugin.png -------------------------------------------------------------------------------- /screenshot/ic_mock_source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_mock_source.png -------------------------------------------------------------------------------- /screenshot/ic_screen_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_screen_demo.gif -------------------------------------------------------------------------------- /screenshot/ic_upload_jar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_upload_jar.jpeg -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /screenshot/ic_mock_annotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/screenshot/ic_mock_annotation.png -------------------------------------------------------------------------------- /mock-method-android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | library 3 | 4 | -------------------------------------------------------------------------------- /mock-method-plugin/src/main/resources/META-INF/gradle-plugins/MockPlugin.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.mock.internel.MockPlugin -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Mock 3 | 4 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | mock1 3 | 4 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /mock-method-android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .DS_Store 5 | /build 6 | /captures 7 | .externalNativeBuild 8 | /.idea/* 9 | /local-repos/* 10 | task.txt 11 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mock-method-plugin/src/main/java/com/mock/internel/Util.java: -------------------------------------------------------------------------------- 1 | package com.mock.internel; 2 | 3 | /** 4 | * Created by spf on 2018/11/21. 5 | */ 6 | public class Util { 7 | } 8 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuneLeo/mock-method/HEAD/mock-method-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 03 10:07:29 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 7 | -------------------------------------------------------------------------------- /mock-method-android/src/main/res/layout/activity_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "mock-method-compiler"] 2 | path = mock-method-compiler 3 | url = git@github.com:JuneLeo/mock-method-compiler.git 4 | branch = master 5 | [submodule "mock-method-annotation"] 6 | path = mock-method-annotation 7 | url = git@github.com:JuneLeo/mock-method-annotation.git 8 | branch = master 9 | -------------------------------------------------------------------------------- /mock-method-plugin/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mock-method-plugin/src/main/groovy/com/mock/internel/MockExtension.groovy: -------------------------------------------------------------------------------- 1 | package com.mock.internel 2 | 3 | class MockExtension { 4 | boolean isEnable = true 5 | static String plugin = "mock" 6 | def packages 7 | boolean dependencyEnable = true 8 | 9 | List subprojects 10 | 11 | } -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mock-method-android/src/main/java/com/mock/generator/IMockMethodMap.java: -------------------------------------------------------------------------------- 1 | package com.mock.generator; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by spf on 2018/12/24. 8 | */ 9 | public interface IMockMethodMap { 10 | void initMackMock(List> mockMethodModels); 11 | } 12 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mock-method-plugin/upload.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply plugin: 'maven' 3 | 4 | uploadArchives { 5 | 6 | repositories.mavenDeployer { 7 | repository(url: uri('../local-repos')) 8 | pom.groupId = 'com.mock.internel' // 组名 9 | pom.artifactId = 'MockPlugin' // 插件名 10 | pom.version = '1.0' // 版本号 11 | } 12 | } -------------------------------------------------------------------------------- /mock-method-plugin/local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Sun Dec 16 17:07:42 CST 2018 8 | sdk.dir=/Users/bighero/Library/Android/sdk 9 | -------------------------------------------------------------------------------- /mock-method-plugin/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':mock-method-sample', ':mock-method-plugin', ':mock-method-android' 2 | include':mock-method-lib-1' 3 | project(':mock-method-lib-1').projectDir = new File('mock-lib/mock-method-lib-1') 4 | 5 | 6 | //compiler 自动生成类 7 | include ':compiler' 8 | project(':compiler').projectDir = new File('mock-method-compiler/library') 9 | //注解 10 | include ':annotation' 11 | project(':annotation').projectDir = new File('mock-method-annotation/library') -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/src/main/java/com/mock/lib1/MockMethodTest.java: -------------------------------------------------------------------------------- 1 | package com.mock.lib1; 2 | 3 | import com.mock.annotation.MockMethod; 4 | 5 | /** 6 | * Created by spf on 2019/1/3. 7 | */ 8 | public class MockMethodTest { 9 | @MockMethod(defaultValue = "1", values = "1,2") 10 | public int test() { 11 | return 1; 12 | } 13 | 14 | @MockMethod(defaultValue = "true",values = "false,true") 15 | public boolean isEnable(){ 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mock-method-sample/src/test/java/com/mock/mock/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.mock.mock; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /mock-method-android/src/main/java/com/mock/generator/config/IMockConfig.java: -------------------------------------------------------------------------------- 1 | package com.mock.generator.config; 2 | 3 | import com.mock.generator.MockMethodModel; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by spf on 2019/1/2. 10 | */ 11 | public interface IMockConfig { 12 | 13 | boolean isEnable(); 14 | 15 | Map> getMockMap(); 16 | 17 | void save(); 18 | 19 | void saveModel(MockMethodModel mockMethodModel); 20 | } 21 | -------------------------------------------------------------------------------- /mock-method-android/src/main/res/values/style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /mock-method-android/src/main/res/layout/item_abtest_spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mock-method-plugin/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /mock-method-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | //apply from:file('upload.gradle') 3 | apply plugin: 'com.github.dcendents.android-maven' 4 | group = 'com.github.JuneLeo' 5 | 6 | dependencies { 7 | implementation fileTree(dir: 'libs', include: ['*.jar']) 8 | compile gradleApi() 9 | compile localGroovy() 10 | implementation 'com.android.tools.build:gradle:3.2.1' //build tools 11 | implementation 'com.android.tools.build:transform-api:1.5.0' //transform 12 | implementation 'org.javassist:javassist:3.23.0-GA' //javassist 13 | implementation 'com.github.JuneLeo:mock-method-annotation:1.0.8' 14 | } 15 | 16 | sourceCompatibility = "7" 17 | targetCompatibility = "7" 18 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 14 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation 'com.android.support:appcompat-v7:26.1.0' 29 | // implementation 'com.github.JuneLeo:mock-method-annotation:1.0.8' 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mock-method-android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group = 'com.github.JuneLeo' 5 | android { 6 | compileSdkVersion 26 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 26 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | implementation 'com.android.support:appcompat-v7:26.1.0' 26 | implementation 'com.google.code.gson:gson:2.8.5' 27 | } 28 | -------------------------------------------------------------------------------- /mock-method-plugin/src/main/java/com/mock/internel/MockMethodModel.java: -------------------------------------------------------------------------------- 1 | package com.mock.internel; 2 | 3 | /** 4 | * Created by spf on 2018/12/24. 5 | */ 6 | public class MockMethodModel { 7 | public String className; 8 | public String methodName; 9 | public String returnType; 10 | public String values; 11 | public String defaultValue; 12 | public boolean switcher; 13 | 14 | public MockMethodModel(String className, String methodName, String returnType, String values, String defaultValue) { 15 | this.className = className; 16 | this.methodName = methodName; 17 | this.returnType = returnType; 18 | this.values = values; 19 | this.defaultValue = defaultValue; 20 | 21 | } 22 | 23 | public MockMethodModel() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mock-method-android/src/main/java/com/mock/generator/MockMethodModel.java: -------------------------------------------------------------------------------- 1 | package com.mock.generator; 2 | 3 | /** 4 | * Created by spf on 2018/12/24. 5 | */ 6 | public class MockMethodModel { 7 | public String className; 8 | public String methodName; 9 | public String returnType; 10 | public String values; 11 | public String defaultValue; 12 | public boolean switcher; 13 | 14 | public MockMethodModel(String className, String methodName, String returnType, String values, String defaultValue) { 15 | this.className = className; 16 | this.methodName = methodName; 17 | this.returnType = returnType; 18 | this.values = values; 19 | this.defaultValue = defaultValue; 20 | 21 | } 22 | 23 | public MockMethodModel() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mock-method-android/src/main/java/com/mock/generator/MockMethodGenerator.java: -------------------------------------------------------------------------------- 1 | package com.mock.generator; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | 6 | public class MockMethodGenerator implements IMockMethodMap { 7 | @Override 8 | public void initMackMock(List> mockMethodModels) { 9 | // mockMethodModels.add(getMockMap("com.mock.sample.ui.MainActivity","a","修改为a,修改为b","修改为a")); 10 | //todo plugin会注入代码 11 | } 12 | 13 | private HashMap getMockMap(String className, String methodName, String values, 14 | String defaultValue) { 15 | HashMap map = new HashMap<>(); 16 | map.put("className",className); 17 | map.put("methodName",methodName); 18 | map.put("values",values); 19 | map.put("defaultValue",defaultValue); 20 | return map; 21 | } 22 | } -------------------------------------------------------------------------------- /mock-method-android/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /mock-method-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /mock-lib/mock-method-lib-1/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /mock-method-sample/src/androidTest/java/com/mock/mock/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.mock.mock; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leo.mock", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | #org.gradle.daemon=true 11 | #org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 12 | # When configured, Gradle will run in incubating parallel mode. 13 | # This option should only be used with decoupled projects. More details, visit 14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 15 | # org.gradle.parallel=true 16 | 17 | 18 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /mock-method-sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 |