### Question:
LinkStateDaoHibernate extends AbstractDaoHibernate<OnmsLinkState, Integer> implements LinkStateDao { public OnmsLinkState findByDataLinkInterfaceId(final Integer interfaceId) { return findUnique("from OnmsLinkState as ls where ls.dataLinkInterface.id = ?", interfaceId); } LinkStateDaoHibernate(); @SuppressWarnings("unchecked") Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit); OnmsLinkState findById(Integer id); OnmsLinkState findByDataLinkInterfaceId(final Integer interfaceId); Collection<OnmsLinkState> findByNodeId(Integer nodeId); Collection<OnmsLinkState> findByNodeParentId(Integer nodeParentId);  }### Answer:
@Test @Transactional public void testFindByDataLinkInterfaceId() { int dataLinkId; Collection<DataLinkInterface> dlis = m_dataLinkInterfaceDao.findAll(); assertNotNull(dlis); assertFalse(dlis.isEmpty()); DataLinkInterface dli = dlis.iterator().next(); dataLinkId = dli.getId(); assertNotNull(dli); OnmsLinkState linkState1 = new OnmsLinkState(); linkState1.setDataLinkInterface(dli); m_linkStateDao.save(linkState1); m_linkStateDao.flush(); OnmsLinkState linkState2 = m_linkStateDao.findByDataLinkInterfaceId(dataLinkId); assertNotNull(linkState2); }