I'm creating a test with Mockito. In the test, I'm creating an object of type ContentValues
. When I run this test, I'm getting error:
java.lang.RuntimeException: Method put in android.content.ContentValues not mocked.
Here is the minimal code:
import android.content.ContentValues;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class MyClassTest {
@Test
public void test1() {
ContentValues cv = new ContentValues();
cv.put("key", "value");
}
}
What to do to avoid this error?