12
로그에서 방법 e를 모의하는 방법
여기서 Utils.java는 테스트 할 클래스이고 다음은 UtilsTest 클래스에서 호출되는 메서드입니다. 아래와 같이 Log.e 메서드를 조롱하더라도 @Before public void setUp() { when(Log.e(any(String.class),any(String.class))).thenReturn(any(Integer.class)); utils = spy(new Utils()); } 다음 예외가 발생합니다. java.lang.RuntimeException: Method e in android.util.Log not mocked. See http://g.co/androidstudio/not-mocked for details. at android.util.Log.e(Log.java) at com.xxx.demo.utils.UtilsTest.setUp(UtilsTest.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at …