Goog afternoon,
I search on by database to test on a specific class Test, when I put a new item, if the list contains the item.
@Test
public void insertAndDeleteTask() throws InterruptedException {
Project projectTartampion = new Project(1L, "Projet Tartampion", 0xFFEADAD1);
long projectID1L = projectDao.inserProject(projectTartampion);
Task task1L = new Task(1,projectID1L,"Test",3);
taskDao.insertTask(task1L);
List<Project> allProjects = LiveDataTestUtil.getValue(projectDao.getAllProjects());
assertNotNull(allProjects);
assertFalse(allProjects.isEmpty());
List<Task> allTasks = LiveDataTestUtil.getValue(taskDao.getAllTasks());
assertNotNull(allTasks);
assertFalse(allTasks.isEmpty());
Log.i("TAG","***********************************"+LiveDataTestUtil.getValue(taskDao.getAllTasks()));
assertThat(allTasks, contains(task1L));//HERE TO TEST IF allTasks contains task1L/////
Error result on log Test :
iterable containing info Task{id=1, projectId=1, name='Test', creationTimestamp=3} but: item 0: was Task{id=1, projectId=1, name='Test', creationTimestamp=3}
But I don't exactly understand what's happening, because when I use the Log.i to see if my item is in the list, it is on.
Thanks for your answer
Aucun commentaire:
Enregistrer un commentaire