如何使用assertj android比较两种意图

如何使用assertj android比较两种意图,android,android-intent,robolectric,android-assertj,Android,Android Intent,Robolectric,Android Assertj,嗨,我正在使用roboelectric对我的android应用程序进行单元测试。我想使用assertjandroid比较预期意图和实际意图。我已经添加了assertj android所需的依赖项,尽管我已经多次进行了Gradle同步,但仍然无法导入org.assertj.android.api.content.IntentAssert 可能是什么问题?有什么想法吗?提前谢谢 格雷德尔先生 您的build.gradle中的AssertJ依赖项用于androidTest,并且应该用于测试,因为您使用

嗨,我正在使用roboelectric对我的android应用程序进行单元测试。我想使用
assertjandroid
比较预期意图和实际意图。我已经添加了
assertj android
所需的依赖项,尽管我已经多次进行了Gradle同步,但仍然无法导入
org.assertj.android.api.content.IntentAssert

可能是什么问题?有什么想法吗?提前谢谢

格雷德尔先生

您的build.gradle中的AssertJ依赖项用于androidTest,并且应该用于测试,因为您使用的是Robolectric?

如何使用AssertJ android比较两种意图?我认为您无法使用IntentAssert来实现这一点。但是,您可以检查实施内容,例如检查其组件:因此您将拥有assertThat(实施内容).hasComponent(mainActivity,SecondActivity.class);
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'
    testCompile 'org.robolectric:robolectric:3.2.2'
    testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
    androidTestCompile 'com.squareup.assertj:assertj-android:1.1.1'
}