### Question:
OnmsMapElementDaoHibernate extends AbstractDaoHibernate<OnmsMapElement, Integer> implements OnmsMapElementDao { public Collection<OnmsMapElement> findElementsByType(String type) { return find("from OnmsMapElement as element where element.type = ?", type); } OnmsMapElementDaoHibernate(); @SuppressWarnings("unchecked") Collection<OnmsMapElement> findAll(final Integer offset, final Integer limit); OnmsMapElement findElementById(int id); Collection<OnmsMapElement> findElementsByMapId(OnmsMap map); Collection<OnmsMapElement> findElementsByNodeId(int nodeid); void deleteElementsByMapId(final OnmsMap map); void deleteElementsByNodeid(final int nodeid); void deleteElementsByType(final String type); void deleteElementsByElementIdAndType(final int id,final String type); Collection<OnmsMapElement> findElementsByElementIdAndType(
            int elementId, String type); Collection<OnmsMapElement> findElementsByType(String type); OnmsMapElement findElement(int elementId, String type, OnmsMap map); void deleteElementsByMapType(final String mapType); Collection<OnmsMapElement> findElementsByMapIdAndType(int mapId,
            String type); Collection<OnmsMapElement> findMapElementsOnMap(int mapId); Collection<OnmsMapElement> findNodeElementsOnMap(int mapId); int countElementsOnMap(final int mapid);  }### Answer:
@Test @Transactional public void testFindElementsByType1() { Collection<OnmsMapElement> elems = m_onmsMapElementDao.findElementsByType(OnmsMapElement.NODE_TYPE); assertEquals(1,elems.size()); OnmsMapElement mapElement = elems.iterator().next(); assertEquals(62, mapElement.getMap().getId()); assertEquals(1, mapElement.getElementId()); assertEquals(OnmsMapElement.NODE_TYPE, mapElement.getType()); assertEquals("Test Node", mapElement.getLabel()); assertEquals(OnmsMapElement.defaultNodeIcon, mapElement.getIconName()); assertEquals(0, mapElement.getX()); assertEquals(10, mapElement.getY()); }
@Test @Transactional public void testFindElementsByType2() { Collection<OnmsMapElement> elems = m_onmsMapElementDao.findElementsByType(OnmsMapElement.MAP_TYPE); assertEquals(0,elems.size()); }