{"action":"created","issue":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/1859","labels_url":"https://api.github.com/repos/robolectric/robolectric/issues/1859/labels{/name}","comments_url":"https://api.github.com/repos/robolectric/robolectric/issues/1859/comments","events_url":"https://api.github.com/repos/robolectric/robolectric/issues/1859/events","html_url":"https://github.com/robolectric/robolectric/issues/1859","id":83906417,"number":1859,"title":"Support appcompat-v7 22.2.0","user":{"login":"kluz88","id":6829954,"avatar_url":"https://avatars.githubusercontent.com/u/6829954?v=3","gravatar_id":"","url":"https://api.github.com/users/kluz88","html_url":"https://github.com/kluz88","followers_url":"https://api.github.com/users/kluz88/followers","following_url":"https://api.github.com/users/kluz88/following{/other_user}","gists_url":"https://api.github.com/users/kluz88/gists{/gist_id}","starred_url":"https://api.github.com/users/kluz88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kluz88/subscriptions","organizations_url":"https://api.github.com/users/kluz88/orgs","repos_url":"https://api.github.com/users/kluz88/repos","events_url":"https://api.github.com/users/kluz88/events{/privacy}","received_events_url":"https://api.github.com/users/kluz88/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/robolectric/robolectric/labels/3.0","name":"3.0","color":"c7def8"},{"url":"https://api.github.com/repos/robolectric/robolectric/labels/enhancement","name":"enhancement","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/robolectric/robolectric/milestones/7","html_url":"https://github.com/robolectric/robolectric/milestones/3.1","labels_url":"https://api.github.com/repos/robolectric/robolectric/milestones/7/labels","id":1083024,"number":7,"title":"3.1","description":"","creator":{"login":"erd","id":184194,"avatar_url":"https://avatars.githubusercontent.com/u/184194?v=3","gravatar_id":"","url":"https://api.github.com/users/erd","html_url":"https://github.com/erd","followers_url":"https://api.github.com/users/erd/followers","following_url":"https://api.github.com/users/erd/following{/other_user}","gists_url":"https://api.github.com/users/erd/gists{/gist_id}","starred_url":"https://api.github.com/users/erd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erd/subscriptions","organizations_url":"https://api.github.com/users/erd/orgs","repos_url":"https://api.github.com/users/erd/repos","events_url":"https://api.github.com/users/erd/events{/privacy}","received_events_url":"https://api.github.com/users/erd/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":5,"state":"open","created_at":"2015-04-25T00:15:41Z","updated_at":"2015-08-07T06:08:25Z","due_on":null,"closed_at":null},"comments":16,"created_at":"2015-06-02T08:16:57Z","updated_at":"2015-09-07T08:25:03Z","closed_at":null,"body":"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.\r\n\tat android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:122)\r\n\tat android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)\r\n\tat android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)\r\n\tat de.psdev.stabbedandroid.StabbedAppCompatActivity.onCreate(StabbedAppCompatActivity.java:31)\r\n\tat com.purplemotion.app.purple.TrackingStabbedAppCompatActivity.onCreate(TrackingStabbedAppCompatActivity.java:27)\r\n\tat com.purplemotion.app.purple.PurpleBaseActivity.onCreate(PurpleBaseActivity.java:91)\r\n\tat com.purplemotion.app.purple.splash.SplashActivity.onCreate(SplashActivity.java:85)\r\n\tat android.app.Activity.performCreate(Activity.java:5133)\r\n\tat org.robolectric.util.ReflectionHelpers$3.run(ReflectionHelpers.java:144)\r\n\tat org.robolectric.util.ReflectionHelpers.traverseClassHierarchy(ReflectionHelpers.java:241)\r\n\tat org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:138)\r\n\tat org.robolectric.util.ActivityController$1.run(ActivityController.java:122)\r\n\tat org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:309)\r\n\tat org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:47)\r\n\tat org.robolectric.util.ActivityController.create(ActivityController.java:118)\r\n\tat org.robolectric.util.ActivityController.create(ActivityController.java:129)\r\n\tat com.purplemotion.app.purple.splash.SplashActivityTest.setup(SplashActivityTest.java:21)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)\r\n\tat org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:235)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:168)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:137)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)\r\n"},"comment":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/comments/138230508","html_url":"https://github.com/robolectric/robolectric/issues/1859#issuecomment-138230508","issue_url":"https://api.github.com/repos/robolectric/robolectric/issues/1859","id":138230508,"user":{"login":"happybit","id":1286203,"avatar_url":"https://avatars.githubusercontent.com/u/1286203?v=3","gravatar_id":"","url":"https://api.github.com/users/happybit","html_url":"https://github.com/happybit","followers_url":"https://api.github.com/users/happybit/followers","following_url":"https://api.github.com/users/happybit/following{/other_user}","gists_url":"https://api.github.com/users/happybit/gists{/gist_id}","starred_url":"https://api.github.com/users/happybit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/happybit/subscriptions","organizations_url":"https://api.github.com/users/happybit/orgs","repos_url":"https://api.github.com/users/happybit/repos","events_url":"https://api.github.com/users/happybit/events{/privacy}","received_events_url":"https://api.github.com/users/happybit/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T08:25:03Z","updated_at":"2015-09-07T08:25:03Z","body":"Hi,\r\n\r\nI suppose my issue is similar to this one. Could anybody shed some light on my problem? Thanks a lot!\r\n\r\nTest code:\r\n~~~ java\r\n@RunWith(RobolectricGradleTestRunner.class)\r\n@Config(constants = BuildConfig.class)\r\npublic class AboutFragmentTest {\r\n\r\n    @Test\r\n    public void clickOrigin_shouldStartDisplayOriginActivity() {\r\n        final AboutFragment fragment = AboutFragment.newInstance();\r\n        SupportFragmentTestUtil.startFragment(fragment);\r\n\r\n        fragment.getView().findViewById(R.id.origin).performClick();\r\n\r\n        Intent expectedIntent = new Intent(fragment.getActivity(), DisplayOriginActivity.class);\r\n        assertThat(shadowOf(fragment.getActivity()).getNextStartedActivity()).isEqualTo(expectedIntent);\r\n\r\n    }\r\n}\r\n~~~\r\n\r\nMainActivity extends appcompat-v7 AppCompatActivity. Fragment code snippet:\r\n~~~ java\r\n@Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n                             Bundle savedInstanceState) {\r\n        // Inflate the layout for this fragment\r\n        final View view = inflater.inflate(R.layout.fragment_about, container, false);\r\n\r\n        Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);\r\n        if (toolbar != null) {\r\n            toolbar.getMenu().clear();\r\n        }\r\n\r\n        // Set title bar\r\n        ActionBar supportActionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();\r\n        if (supportActionBar != null) {\r\n            supportActionBar.setTitle(getActivity().getString(R.string.drawerlayout_menu_about));\r\n            supportActionBar.setElevation(12.0f);\r\n        }\r\n}\r\n~~~\r\n\r\nUnit testing output:\r\n~~~\r\njava.lang.ClassCastException: org.robolectric.shadows.support.v4.SupportFragmentTestUtil$FragmentUtilActivity cannot be cast to android.support.v7.app.AppCompatActivity\r\n\tat in.xinyue.xinyue.ui.fragment.AboutFragment.onCreateView(AboutFragment.java:67)\r\n\tat android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)\r\n\tat android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)\r\n\tat android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)\r\n\tat android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)\r\n\tat android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)\r\n\tat android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458)\r\n\tat android.os.Handler.handleCallback(Handler.java:739)\r\n\tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n\tat org.robolectric.shadows.ShadowMessageQueue.dispatchMessage(ShadowMessageQueue.java:130)\r\n\tat org.robolectric.shadows.ShadowMessageQueue.access$100(ShadowMessageQueue.java:30)\r\n\tat org.robolectric.shadows.ShadowMessageQueue$1.run(ShadowMessageQueue.java:95)\r\n\tat org.robolectric.util.Scheduler.runOrQueueRunnable(Scheduler.java:230)\r\n\tat org.robolectric.util.Scheduler.postDelayed(Scheduler.java:85)\r\n\tat org.robolectric.shadows.ShadowMessageQueue.enqueueMessage(ShadowMessageQueue.java:116)\r\n\tat android.os.MessageQueue.enqueueMessage(MessageQueue.java)\r\n\tat android.os.Handler.enqueueMessage(Handler.java:631)\r\n\tat android.os.Handler.sendMessageAtTime(Handler.java:600)\r\n\tat android.os.Handler.sendMessageDelayed(Handler.java:570)\r\n\tat android.os.Handler.post(Handler.java:326)\r\n\tat android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1407)\r\n\tat android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:637)\r\n\tat android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:616)\r\n\tat org.robolectric.shadows.support.v4.SupportFragmentTestUtil.startFragment(SupportFragmentTestUtil.java:17)\r\n\tat in.xinyue.xinyue.ui.fragment.AboutFragmentTest.clickOrigin_shouldStartDisplayOriginActivity(AboutFragmentTest.java:30)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n\tat org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:251)\r\n\tat org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)\r\n\tat org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:152)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:137)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)\r\n\r\n\r\nProcess finished with exit code -1\r\n~~~"}}