Mockito.spy(Activity).getBaseContext() returns null on Robolectric 4.4 and Java8
See original GitHub issueDescription
Since robolectric 4.4, Mockito.spy(Activity).getBaseContext() returns null
Steps to Reproduce
$ git clone -b mockito_spy_robolectric_4_4 https://github.com/ganadist/VersionCodeDemo demo
$ cd demo
// switch to robolectric 4.3.1
$ git checkout HEAD~1
$ ./gradlew :app:testDevelopDebugUnitTest
BUILD SUCCESSFUL in 14s
28 actionable tasks: 28 executed
// switch to robolectric 4.4
$ git checkout mockito_spy_robolectric_4_4
$ ./gradlew :app:testDevelopDebugUnitTest
> Task :app:testDevelopDebugUnitTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:testDevelopDebugUnitTest'.
Failed unittest result : https://scans.gradle.com/s/wbmmbnzatcyai/tests/:app:testDevelopDebugUnitTest/com.example.myapplication.UnitTest1/test1#1
Robolectric & Android Version
- Compile Sdk : 29
- Target Sdk : 28
- Robolectric : 4.4
- Mockito : 3.5.10
- Jvm : OpenJDK 8
Link to a public git repo demonstrating the problem:
This issue is copied from https://github.com/robolectric/robolectric/issues/5916
Issue Analytics
- State:
- Created 3 years ago
- Comments:38 (16 by maintainers)
Top Results From Across the Web
[GitHub] [fineract] renovate-bot opened a new pull request #1334 ...
[(#2046)](https://togithub.com/mockito/mockito/pull/2046) - Mockito.spy(Activity).getBaseContext() returns null on Robolectric 4.4 and Java8 ...
Read more >Bump 小米核从1.9.5到3.5.15:Bump mockito-core from ... - 编程技术网
[(#2046)](mockito/mockito#2046) Mockito.spy(Activity).getBaseContext() returns null on Robolectric 4.4 and Java8 [(#2040)](mockito/mockito#2040). За。5.10。
Read more >[FIXED] Create file with Unit Test with Android in the emulator ...
@Test public void testGenerateFile() throws IOException { Context context ... This is a folder generated for robolectric instrumented test.
Read more >Bump mockito-junit-jupiter from 3.5.9 to 3.6.0 - developer blog
Superseded by #105. Project: java-handbook. About this topic(Bump mockito-junit-jupiter from 3.5.9 to 3.6 ...
Read more >Android client for Travis CI - AndroidRepo
brave-warrior/TravisClient-Android, Project description This project is unofficial Android client for Travis CI. It uses API v2 from Travis ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for all your hard work @raphw! I am glad this is fixed.
Right back at you! Thanks for your patient debugging help!