When starting an integration test with Espresso, I initially was getting an error stating that AndroidJUnit4 is deprecated.
Following the solution from StackOverflow
Adding the following dependency solved the problem
androidTestImplementation 'androidx.test.ext:junit:1.1.1'