Search in sources :

Example 6 with OsmQuestDao

use of de.westnordost.streetcomplete.data.osm.persist.OsmQuestDao in project StreetComplete by westnordost.

the class OsmQuestChangesUploadTest method testDropChangeWhenUnresolvableElementChange.

public void testDropChangeWhenUnresolvableElementChange() {
    OsmQuest quest = createAnsweredQuestWithNonAppliableChange();
    Element element = createElement();
    OsmQuestDao questDb = mock(OsmQuestDao.class);
    MergedElementDao elementDao = mock(MergedElementDao.class);
    DownloadedTilesDao downloadedTilesDao = mock(DownloadedTilesDao.class);
    OsmQuestChangesUpload u = new OsmQuestChangesUpload(null, questDb, elementDao, null, null, null, null, downloadedTilesDao, null, null);
    assertFalse(u.uploadQuestChange(123, quest, element, false, false));
    verify(questDb).delete(quest.getId());
    verify(downloadedTilesDao).remove(any(Point.class));
}
Also used : Element(de.westnordost.osmapi.map.data.Element) OsmQuestDao(de.westnordost.streetcomplete.data.osm.persist.OsmQuestDao) Point(android.graphics.Point) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) DownloadedTilesDao(de.westnordost.streetcomplete.data.tiles.DownloadedTilesDao) MergedElementDao(de.westnordost.streetcomplete.data.osm.persist.MergedElementDao)

Example 7 with OsmQuestDao

use of de.westnordost.streetcomplete.data.osm.persist.OsmQuestDao in project StreetComplete by westnordost.

the class OsmQuestChangesUploadTest method testUploadNormally.

public void testUploadNormally() {
    OsmQuest quest = createAnsweredQuestWithAppliableChange();
    Element element = createElement();
    OsmQuestDao questDb = mock(OsmQuestDao.class);
    MapDataDao mapDataDao = mock(MapDataDao.class);
    QuestStatisticsDao statisticsDao = mock(QuestStatisticsDao.class);
    MergedElementDao elementDb = mock(MergedElementDao.class);
    OsmQuestUnlocker osmQuestUnlocker = mock(OsmQuestUnlocker.class);
    OsmQuestChangesUpload u = new OsmQuestChangesUpload(mapDataDao, questDb, elementDb, null, statisticsDao, null, null, null, null, osmQuestUnlocker);
    assertTrue(u.uploadQuestChange(1, quest, element, false, false));
    assertEquals(QuestStatus.CLOSED, quest.getStatus());
    verify(statisticsDao).addOne("TestQuestType");
}
Also used : OsmQuestUnlocker(de.westnordost.streetcomplete.data.osm.OsmQuestUnlocker) Element(de.westnordost.osmapi.map.data.Element) OsmQuestDao(de.westnordost.streetcomplete.data.osm.persist.OsmQuestDao) MapDataDao(de.westnordost.osmapi.map.MapDataDao) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) QuestStatisticsDao(de.westnordost.streetcomplete.data.statistics.QuestStatisticsDao) MergedElementDao(de.westnordost.streetcomplete.data.osm.persist.MergedElementDao)

Aggregations

OsmQuestDao (de.westnordost.streetcomplete.data.osm.persist.OsmQuestDao)7 OsmQuest (de.westnordost.streetcomplete.data.osm.OsmQuest)6 MergedElementDao (de.westnordost.streetcomplete.data.osm.persist.MergedElementDao)5 Point (android.graphics.Point)4 Element (de.westnordost.osmapi.map.data.Element)4 DownloadedTilesDao (de.westnordost.streetcomplete.data.tiles.DownloadedTilesDao)4 MapDataDao (de.westnordost.osmapi.map.MapDataDao)3 OpenChangesetsDao (de.westnordost.streetcomplete.data.changesets.OpenChangesetsDao)3 SharedPreferences (android.content.SharedPreferences)2 ElementGeometryDao (de.westnordost.streetcomplete.data.osm.persist.ElementGeometryDao)2 ChangesetsDao (de.westnordost.osmapi.changesets.ChangesetsDao)1 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)1 QuestType (de.westnordost.streetcomplete.data.QuestType)1 OpenChangesetKey (de.westnordost.streetcomplete.data.changesets.OpenChangesetKey)1 OsmQuestUnlocker (de.westnordost.streetcomplete.data.osm.OsmQuestUnlocker)1 OsmNoteQuestDao (de.westnordost.streetcomplete.data.osmnotes.OsmNoteQuestDao)1 QuestStatisticsDao (de.westnordost.streetcomplete.data.statistics.QuestStatisticsDao)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1