在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bjoernQ/unmock-plugin开源软件地址(OpenSource Url):https://github.com/bjoernQ/unmock-plugin开源编程语言(OpenSource Language):Java 91.5%开源软件介绍(OpenSource Introduction):Android Unmock Gradle PluginPurposeThis is a super simple plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio. ( http://tools.android.com/tech-docs/unit-testing-support ) It tries to solve the problem that you have to mock each and every Android SDK class (even SparseArray, TextUtils etc.) by allowing you to use selected classes from a real Android-Jarfile. How to useAdd the plugin to your buildscript dependencies and make sure to use the maven central repository: buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.bjoernq:unmockplugin:0.7.9'
}
} Please note: Versions prior to 0.7.6 are not available on Maven Central. And this to the module's build script: apply plugin: 'de.mobilej.unmock' Additionally you have to configure which classes to use and where to get the real Android.jar from. e.g: unMock {
keep "android.widget.BaseAdapter"
keep "android.widget.ArrayAdapter"
keep "android.os.Bundle"
keepStartingWith "android.database.MatrixCursor"
keep "android.database.AbstractCursor"
keep "android.database.CrossProcessCursor"
keepStartingWith "android.text.TextUtils"
keepStartingWith "android.util."
keepStartingWith "android.text."
keepStartingWith "android.content.ContentValues"
keepStartingWith "android.content.ComponentName"
keepStartingWith "android.content.ContentUris"
keepStartingWith "android.content.ContentProviderOperation"
keepStartingWith "android.content.ContentProviderResult"
keepStartingWith "android.content.UriMatcher"
keepStartingWith "android.content.Intent"
keep "android.location.Location"
keepStartingWith "android.content.res.Configuration"
keepStartingWith "org."
keepStartingWith "libcore."
keepStartingWith "com.android.internal.R"
keepStartingWith "com.android.internal.util."
keep "android.net.Uri"
keepAndRename "java.nio.charset.Charsets" to "xjava.nio.charset.Charsets"
}
dependencies {
// dependency to android-all to use
unmock 'org.robolectric:android-all:4.3_r2-robolectric-0'
}
That's it! Have a look at the example contained in this repository for more details. Starting from version 0.3.5 you can leave out the configuration closure which will result using defaults (which are shown in the example above). If you use any of the keep statements the default configuration will be cleared. (So your own configuration is not adding but replaces the default). If you don't configure the unmock dependency the plugin will use Versions
License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论