Actually, I need to get a response of an API call, for that I required Context.
Agree with answers of @EugenMartynov and @rds ....
A quick example can be found at Volley-Marshmallow-Release
in NetworkImageViewTest.java
// mNIV = new NetworkImageView(Robolectric.application);
mNIV = new NetworkImageView(RuntimeEnvironment.application);
Volley link is available https://android.googlesource.com/platform/frameworks/volley/+/marshmallow-release
you have to add dependencies in volley module in android studio as :
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.robolectric:robolectric:3.1.2'
}