use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class OsmNotesDownloadTest method createANote.
private Note createANote() {
Note note = new Note();
note.id = 4;
note.position = new OsmLatLon(6.0, 7.0);
note.status = Note.Status.OPEN;
note.dateCreated = new Date();
NoteComment comment = new NoteComment();
comment.date = new Date();
comment.action = NoteComment.Action.OPENED;
comment.text = "hurp durp";
note.comments.add(comment);
return note;
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class NoteDaoTest method testDeleteUnreferenced.
public void testDeleteUnreferenced() {
Note note = createNote();
dao.put(note);
assertEquals(1, dao.deleteUnreferenced());
dao.put(note);
new OsmNoteQuestDao(dbHelper, serializer, new OsmNoteQuestType()).add(new OsmNoteQuest(note, new OsmNoteQuestType()));
assertEquals(0, dao.deleteUnreferenced());
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class NoteDaoTest method testDelete.
public void testDelete() {
Note note = createNote();
assertFalse(dao.delete(note.id));
dao.put(note);
assertTrue(dao.delete(note.id));
assertNull(dao.get(note.id));
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class NoteDaoTest method testPutGetNoClosedDate.
public void testPutGetNoClosedDate() {
Note note = createNote();
dao.put(note);
Note dbNote = dao.get(note.id);
checkEqual(note, dbNote);
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class OsmNoteQuestDaoTest method testAddTwice.
public void testAddTwice() {
// tests if the "unique" property is set correctly in the table
Note note = NoteDaoTest.createNote();
noteDao.put(note);
OsmNoteQuest quest = new OsmNoteQuest(note, questType);
dao.add(quest);
OsmNoteQuest questForSameNote = new OsmNoteQuest(note, questType);
questForSameNote.setStatus(QuestStatus.HIDDEN);
boolean result = dao.add(questForSameNote);
List<OsmNoteQuest> quests = dao.getAll(null, null);
assertEquals(1, quests.size());
assertEquals(QuestStatus.NEW, quests.get(0).getStatus());
assertFalse(result);
assertNull(questForSameNote.getId());
}
Aggregations