You can change the locale programmatically in an Espresso test too.
Here you can find a quick example I wrote.
The key part is to restart the Activity after you have set the new Locale.
Of course you can also set the flag of ActivityTestRule to manually re-launch the Activity so that you launch it after you set the new Locale.
Just ensure you have a new Activity after you change Locale.
Bear in mind that to change the locale taking into account all the deprecations and sdk versions is more complex than the code I wrote in my example. Read more here.