Я пишу модульный тест в андроида студии и с помощью PowerMockPowerMock издевается MoreAsserts
Тест выглядит следующим образом
@RunWith(PowerMockRunner.class)
@PrepareOnlyThisForTest({Typeface.class})
public class ExtendedTextViewTest {
...
@Test
public void ctor_context_attributeSet_ShouldSetTypeface() throws Exception {
// Act
final LinkedList<Typeface> actualTypefaces = new LinkedList<Typeface>();
ExtendedTextView textView = spy(new ExtendedTextView(contextMock, attributeSet) {
@Override
public void setTypeface(Typeface typeface) {
actualTypefaces.add(typeface);
}
});
// Assert
MoreAsserts.assertEquals(new Typeface[]{typefaceMock}, actualTypefaces.toArray());
verify(typedArrayMock, times(1)).recycle();
}
}
Когда я запускаю тест я получаю сообщение об ошибке:
java.lang.RuntimeException: Method assertEquals in android.test.MoreAsserts not mocked. See http://g.co/androidstudio/not-mocked for details.
at android.test.MoreAsserts.assertEquals(MoreAsserts.java)
at com.loka.loka.common.ExtendedTextViewTest.ctor_context_attributeSet_ShouldSetTypeface(ExtendedTextViewTest.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
Кажется, что mockito издевается над MoreAsserts, не спрашивая меня об этом ... что мне не хватает?
Спасибо, Слава