use of de.westnordost.osmapi.map.data.Way in project StreetComplete by westnordost.
the class CreateNoteUploadTest method testCreateNoteWithNoQuestTitleButAssociatedElement.
public void testCreateNoteWithNoQuestTitleButAssociatedElement() {
CreateNote createNote = createACreateNote();
createNote.elementType = Element.Type.WAY;
createNote.elementId = 5L;
when(mapDataDao.getWay(createNote.elementId)).thenReturn(mock(Way.class));
Note note = createNote(null);
when(notesDao.create(any(LatLon.class), anyString())).thenReturn(note);
assertNotNull(createNoteUpload.uploadCreateNote(createNote));
verify(notesDao).create(createNote.position, "for https://www.openstreetmap.org/way/5 via " + ApplicationConstants.USER_AGENT + ":\n\njo ho");
verifyNoteInsertedIntoDb(createNote.id, note);
}
use of de.westnordost.osmapi.map.data.Way in project StreetComplete by westnordost.
the class CreateNoteUploadTest method testCreateNoteWithAssociatedElementAndNoNoteYet.
public void testCreateNoteWithAssociatedElementAndNoNoteYet() {
CreateNote createNote = createACreateNote();
createNote.elementType = Element.Type.WAY;
createNote.elementId = 5L;
createNote.questTitle = "What?";
when(mapDataDao.getWay(createNote.elementId)).thenReturn(mock(Way.class));
Note note = createNote(createNote);
when(notesDao.create(any(LatLon.class), anyString())).thenReturn(note);
assertNotNull(createNoteUpload.uploadCreateNote(createNote));
verify(notesDao).create(createNote.position, "Unable to answer \"What?\" for https://www.openstreetmap.org/way/5 via " + ApplicationConstants.USER_AGENT + ":\n\njo ho");
verifyNoteInsertedIntoDb(createNote.id, note);
}
use of de.westnordost.osmapi.map.data.Way in project StreetComplete by westnordost.
the class MergedElementDao method putAll.
public void putAll(Collection<Element> elements) {
Collection<Node> nodes = new ArrayList<>();
Collection<Way> ways = new ArrayList<>();
Collection<Relation> relations = new ArrayList<>();
for (Element element : elements) {
switch(element.getType()) {
case NODE:
nodes.add((Node) element);
break;
case WAY:
ways.add((Way) element);
break;
case RELATION:
relations.add((Relation) element);
break;
}
}
if (!nodes.isEmpty())
nodeDao.putAll(nodes);
if (!ways.isEmpty())
wayDao.putAll(ways);
if (!relations.isEmpty())
relationDao.putAll(relations);
}
use of de.westnordost.osmapi.map.data.Way in project StreetComplete by westnordost.
the class WayDaoTest method testPutGetNoTags.
public void testPutGetNoTags() {
Way way = new OsmWay(5, 1, Arrays.asList(1L, 2L, 3L, 4L), null);
dao.put(way);
Way dbWay = dao.get(5);
checkEqual(way, dbWay);
}
use of de.westnordost.osmapi.map.data.Way in project StreetComplete by westnordost.
the class MergedElementDaoTest method testPutWay.
public void testPutWay() {
Way way = mock(Way.class);
when(way.getType()).thenReturn(Element.Type.WAY);
dao.put(way);
verify(wayDao).put(way);
}
Aggregations