Vladimir Chernis Yes that is correct, the order of execution does matter. RxRule needs to run only at the beginning and at the end of every test class, not after each and every test, while the mock web server rule does require reset to happen after each and every test method.
You will have to use one of the other init() and getInstance() methods provided by the KeyGenerator. See here: https://developer.android.com/reference/javax/crypto/KeyGenerator.html.
You can do something like this in the getSecretKey method:
private SecretKey getSecretKey(final String alias) throws…