Created
May 2, 2020 06:18
-
-
Save husaynhakeem/9cfa0c7ed63736a74e0312c2c16324f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun shouldSendData() { | |
| val scenario = FragmentScenario.launchInContainer(FragmentB::class.java) | |
| // Register result listener | |
| var receivedData = "" | |
| scenario.onFragment { fragment -> | |
| fragment.parentFragmentManager.setFragmentResultListener( | |
| KEY, | |
| fragment, | |
| FragmentResultListener { key, result -> | |
| receivedData = result.getString(KEY_DATA) | |
| }) | |
| } | |
| // Send data | |
| onView(withId(R.id.send_data)).perform(click()) | |
| // Verify data was successfully sent | |
| assertThat(receivedData).isEqualTo("value") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment