As a part of Unit testing I wanted to insert values to DB using content resolver. But when I tried this,
@Before
public void runBeforeTestSignOut() {
ContentValues values = new ContentValues();
String userId="123";
String userInfo="test";
values.put(UserProvider.USER_ID, userId);
values.put(UserProvider.USER_INFO, userInfo);
System.out.print("Values are "+values);
Uri uri = contentResolver.insert(UserProvider.CONTENT_USER_URI, values);
}
Values are still assigned null. I can’t figure out why this is happening. I found some related questions but couldn’t find a solution. Please help me with this.