@Test public void batchCreateOverridableDateValueIsSaved() { Note note = new Note(); note.id = 1; note.date = new Date(); List<Note> notes = new ArrayList<Note>(); notes.add(note); Dao<Integer, Note> dao = dbLite.getDao(Note.class); dao.batchCreateOverridable(notes); Cursor cursor = db.query("Note", null, null, null, null, null, null); cursor.moveToFirst(); long time = cursor.getLong(cursor.getColumnIndex("date")); Assert.assertEquals(note.date.getTime(), time); }
@Test public void batchCreateOverridableTest() { List<Note> notes = new ArrayList<Note>(); Note note = new Note(); note.id = 1; note.author = "john doe"; notes.add(note); Note note2 = new Note(); note2.id = 2; note2.author = "jane doe"; notes.add(note2); Dao<Integer, Note> dao = dbLite.getDao(Note.class); dao.batchCreateOverridable(notes); Cursor cursor = db.query("Note", null, null, null, null, null, null); int numInserted = 0; while (cursor.moveToNext()) ++numInserted; Assert.assertEquals(2, numInserted); }