junit4 - Accessing Application Context in Core Java module inside for JUnit test in Android app -


i have android app, contains multiple java modules, means non-android modules. 1 module core module has no dependency on android app module. takes application context @ runtime.

i need create junit test case in core module, requires android application context. can adding dependency of android application module in core module in intellij idea going project settings.

but junit test, don't want place dependency. there way mock application context?

please, let me know if needs more clarification.

you can mock context below using mockito , use :

private context context;  context = mockito.mock(context.class); 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

Ansible warning on jinja2 braces on when -

html - How to custom Bootstrap grid height? -