Код: Выделить всё
@RunWith(MockitoJUnitRunner.class)
public class loginUnit {
@Mock
TextUtils mMockTextUtils;
@Test
public void checkStringEmpty(){
String empty = "";
when(mMockTextUtils.isEmpty(empty)).thenReturn(true);
assertThat(LoginActivity.isStringEmpty(empty),is(equalTo(true)));
}
Код: Выделить всё
public static boolean isStringEmpty(String s){
return TextUtils.isEmpty(s);
}
Подробнее здесь: https://stackoverflow.com/questions/509 ... not-mocked
Мобильная версия