#117·hugo

@DebugLog annotated method causes Android unit tests to crash/fail

Author: alecplumbCreated Jan 14, 2016Updated Oct 18, 2019

I've created the following example test: https://github.com/alecplumb/hugo/blob/demo_test_failure/hugo-example/src/test/java/com/example/hugo/HugoActivityTest.java

Running the test results in the following error:

java.lang.RuntimeException: Method myLooper in android.os.Looper not mocked. See http://g.co/androidstudio/not-mocked for details.

    at android.os.Looper.myLooper(Looper.java)
    at hugo.weaving.internal.Hugo.enterMethod(Hugo.java:77)
    at hugo.weaving.internal.Hugo.ajc$inlineAccessMethod$hugo_weaving_internal_Hugo$hugo_weaving_internal_Hugo$enterMethod(Hugo.java:1)
    at hugo.weaving.internal.Hugo.logAndExecute(Hugo.java:44)
    at com.example.hugo.HugoActivity.fibonacci(HugoActivity.java:39)
    at com.example.hugo.HugoActivityTest.testFibonacci(HugoActivityTest.java:9)
    ...