Search in sources :

Example 31 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class OsmNoteQuestDaoTest method testAddGetWithChanges.

public void testAddGetWithChanges() {
    Note note = NoteDaoTest.createNote();
    ArrayList<String> imagePaths = new ArrayList<>();
    imagePaths.add("blubbi");
    imagePaths.add("diblub");
    OsmNoteQuest quest = new OsmNoteQuest(null, note, QuestStatus.ANSWERED, "hi da du", new Date(1234), questType, imagePaths);
    noteDao.put(note);
    dao.add(quest);
    OsmNoteQuest dbQuest = dao.get(quest.getId());
    checkEqual(quest, dbQuest);
}
Also used : Note(de.westnordost.osmapi.notes.Note) ArrayList(java.util.ArrayList) Date(java.util.Date)

Example 32 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class OsmNoteQuestDaoTest method testAddReplace.

public void testAddReplace() {
    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.replace(questForSameNote);
    List<OsmNoteQuest> quests = dao.getAll(null, null);
    assertEquals(1, quests.size());
    assertEquals(QuestStatus.HIDDEN, quests.get(0).getStatus());
    assertTrue(result);
}
Also used : Note(de.westnordost.osmapi.notes.Note)

Aggregations

Note (de.westnordost.osmapi.notes.Note)32 OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)10 Date (java.util.Date)8 LatLon (de.westnordost.osmapi.map.data.LatLon)5 ArrayList (java.util.ArrayList)5 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)4 NoteComment (de.westnordost.osmapi.notes.NoteComment)3 Way (de.westnordost.osmapi.map.data.Way)2 QuestStatus (de.westnordost.streetcomplete.data.QuestStatus)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 View (android.view.View)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 Handler (de.westnordost.osmapi.common.Handler)1 SingleElementHandler (de.westnordost.osmapi.common.SingleElementHandler)1 OsmConflictException (de.westnordost.osmapi.common.errors.OsmConflictException)1 NotesDao (de.westnordost.osmapi.notes.NotesDao)1 User (de.westnordost.osmapi.user.User)1 QuestGroup (de.westnordost.streetcomplete.data.QuestGroup)1 VisibleQuestListener (de.westnordost.streetcomplete.data.VisibleQuestListener)1