2016-07-31 24 views
2

私はエスプレッソでUIテストをする方法を学習しており、インテントの状態を確認したいと思っていました。Androidエスプレッソ - 意図通りにallOfメソッドを解決できない

intended(allOf(
    hasAction(equalTo(Intent.ACTION_VIEW)), 
    hasCategories(hasItem(equalTo(Intent.CATEGORY_BROWSABLE))), 
    hasData(hasHost(equalTo("www.google.com"))), 
    hasExtras(allOf(
     hasEntry(equalTo("key1"), equalTo("value1")), 
     hasEntry(equalTo("key2"), equalTo("value2")))), 
     toPackage("com.android.browser"))); 

しかし、それは私のコンパイルにエラーを与える:I'w書かれた何かのようなhereからの例です enter image description here 。これには何が問題なのですか?

答えて

2

あなたはここで完全なサンプルコードを確認することができます。https://github.com/googlesamples/android-testing/blob/master/ui/espresso/IntentsBasicSample/app/src/androidTest/java/com/example/android/testing/espresso/BasicSample/DialerActivityTest.java

は、次の輸入品で動作します:

import static android.support.test.espresso.intent.Intents.intended; 
import static android.support.test.espresso.intent.matcher.BundleMatchers.hasEntry; 
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction; 
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasCategories; 
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData; 
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtras; 
import static android.support.test.espresso.intent.matcher.IntentMatchers.toPackage; 
import static android.support.test.espresso.intent.matcher.UriMatchers.hasHost; 
import static org.hamcrest.Matchers.equalTo; 
import static org.hamcrest.Matchers.hasItem; 
import static org.hamcrest.core.AllOf.allOf; 
関連する問題