What steps will reproduce the problem?
1.Create test
@RunWith(AndroidJUnit4.class)
public class SetupAccountWizardTest {
@Rule
public IntentsTestRule<AccountWizard_> testCase = new IntentsTestRule<>(AccountWizard_.class);
@Test
public void test1AAAAAAA(){
Intent i = new Intent("BOB");
testCase.getActivity().sendBroadcast(i);
intended(
allOf(isInternal(),
hasAction("BOB")//,
));
}
}
2. Run android test.
3. Test fails.
What is the expected output? What do you see instead?
Expect to see test complete good!
See fail..
android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCaus
eError: Wanted to match 1 intents. Actually matched 0 intents.
IntentMatcher: (target package: nz.org.winters.android.nzmobileaccountwidget
and has action: is "BOB")
Matched intents:[]
Recorded intents:[]
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:580)
at
android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(De
faultFailureHandler.java:82)
at
android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHa
ndler.java:53)
at
android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInt
eraction.java:184)
at android.support.test.espresso.ViewInteraction.check(ViewInteraction.java:158)
at android.support.test.espresso.intent.Intents.intended(Intents.java:186)
at android.support.test.espresso.intent.Intents.intended(Intents.java:169)
at
nz.org.winters.android.nzmobileaccountwidget.tests.setup.SetupAccountWizardTest.
test1AAAAAAA(SetupAccountWizardTest.java:107)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java
:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:4
2)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20
)
at
android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadState
ment.java:55)
at
android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTe
stRule.java:257)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68
)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47
)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at
android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:54)
at
android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:2
28)
at
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
Caused by: junit.framework.AssertionFailedError: Wanted to match 1 intents.
Actually matched 0 intents.
IntentMatcher: (target package: nz.org.winters.android.nzmobileaccountwidget
and has action: is "BOB")
Matched intents:[]
Recorded intents:[]
at junit.framework.Assert.fail(Assert.java:50)
at
android.support.test.espresso.intent.VerificationModes$Times.verify(Verification
Modes.java:87)
at
android.support.test.espresso.intent.Intents.internalIntended(Intents.java:281)
at android.support.test.espresso.intent.Intents$2.check(Intents.java:189)
at android.support.test.espresso.ViewInteraction$2.run(ViewInteraction.java:170)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Seems no intents are recorded..
All other espresso tests work fine!
Using espresso 2.1
Original issue reported on code.google.com by mat...@winters.org.nz on 4 May 2015 at 2:32
Original issue reported on code.google.com by
mat...@winters.org.nz
on 4 May 2015 at 2:32