Search code examples
androidandroid-intentrobolectricandroid-assertj

How to compare two intent using assertj-android


Hi I am using roboelectric for unit testing of my android application. I want to compare expected intent and actual intent using assertj-android. I have added required dependency of assertj-android, even though I have done Gradle sync multiple times but still unable to import org.assertj.android.api.content.IntentAssert.

What could be the issue ? Any idea ? Thanks in advance

build.gradle

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'
}

enter image description here


Solution

  • AssertJ dependency in your build.gradle is for androidTest and it should be for test since you're using Robolectric?