小编Ima*_*nol的帖子

如何测试使用google-truth抛出预期的异常?

我只想测试是否使用google-truth抛出了给定消息的异常.

使用junit很容易做到这一点@Test(expected=,但是我无法弄清楚如何用真理做到这一点.ThrowableSubject周围没有样本.

我应该坚持使用普通JUnit的这种测试吗?

java junit google-truth

16
推荐指数
1
解决办法
5928
查看次数

如何以编程方式设置操作栏的高度

我正在android操作栏中实现自定义视图.问题是在某些情况下我需要将操作栏的高度加倍以允许视图完全显示.我可以使用自定义主题设置高度,但此高度是静态的.

是否可以以编程方式更改操作栏高度?

提前致谢

android android-actionbar android-actionbar-compat

10
推荐指数
1
解决办法
7625
查看次数

无法运行android espresso测试

我正在尝试运行Android espresso测试,但他们仍然使用java.lang.NoClassDefFoundError失败:com.blokura.testexample.app.MainActivity

我正在使用Jake Wharton的双浓缩咖啡插件.

我试过Jake的设置,就像在github repodeckard看到的那样没有运气.

我不知道我错过了什么.

这是项目结构 项目结构

这是build.gradle文件源代码:

    apply plugin: 'android'

android {
    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
    }

    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    sourceSets {
        androidTest {
            setRoot('src/test')
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    androidTestCompile 'com.jakewharton.espresso:espresso:1.1-r3'
    androidTestCompile 'com.jakewharton.espresso:espresso-support-v4:1.1-r3' …
Run Code Online (Sandbox Code Playgroud)

android integration-testing android-espresso

4
推荐指数
1
解决办法
4278
查看次数