I'm trying to test Room database. my code is as below but TestUtill is red.
@Test
public void writeUserAndReadInList() throws Exception {
UserRequest user = TestUtil.createUser(3);
user.setFullname("george");
mUserDao.insertAll(user);
List<UserRequest> byName = mUserDao.findByName("george");
assertThat(byName.get(0), equalTo(user));
}
also I have an incompatible error message in line List<UserRequest> byName = mUserDao.findByName("george");
, saying it required java.util.list found mypackagename.RequestUser
You need to create that TestUtil
class.
Here is the one in Kotlin: TestUtil
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.