Creating intent in test: “Method putExtra in android.content.Intent not mocked”
问题 I'm trying to unit test a broadcast receiver which listens for "com.android.music.metachanged" intents using JUnit4 and Mockito. The broadcast receiver starts a service when it receives an intent. I want to assert that the service is started. I also want to assert that the string extra "artist" of the received intent is the same as the one of the sent intent. This is what I have so far... @RunWith(PowerMockRunner.class) public class MusicBroadcastReceiverUnitTest { private