Open emartynov opened 5 years ago
Quick answer: Usage of android.app.AlertDialog
or passing proper themeResId to fragment fixes the problem.
I've encountered same issue and prepared a sample project showcasing the exception: https://github.com/marcinbak/robolectric-alertdialog-issue
During implementation I realised that the problem was caused by usage of androidx.appcompat.app.AlertDialog
together with launchFragmentInContainer
extension function without passing proper themeResId.
Description
I have Robolectric tests in the module project.
They are run with:
Where Test application has the next lines:
I'm testing fragments and I just add them to
AppCompatActivity
. All tests are working fine expect ones that try to showAlertDialog
:Steps to Reproduce
Test showing alert dialog.
Robolectric & Android Version
We are on API 28 and Robolectric 4.3.
Link to a public git repo demonstrating the problem:
Sorry it is the company project. I will try to create some test project this week.