mercredi 2 décembre 2015

TooManyMethodsFoundException on a suppress with Bundle.class

When trying to run tests with mock objects, I got the following error:

    org.powermock.reflect.exceptions.TooManyMethodsFoundException: Several matching methods found, please specify the argument parameter types so that PowerMock can determine which method you're referring to.
Matching methods in class android.support.v7.app.AppCompatActivity were:
void onCreate( android.os.Bundle.class )
void onCreate( android.os.Bundle.class android.os.PersistableBundle.class )
void onCreate( android.os.Bundle.class )
void onCreate( android.os.Bundle.class )
void onCreate( android.os.Bundle.class )

at nl.han.alfam.presentation.CarDetailsActivityTest.setUp(CarDetailsActivityTest.java:47)

Line 47:

suppress(method(AppCompatActivity.class, "onCreate", Bundle.class));

There are apparently multiple methods that support a Bundle.class paramter. I've tried without Bundle.class too, but that didn't help at all.

Aucun commentaire:

Enregistrer un commentaire