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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -