### Question:
HibernateSystemMessageDAO extends HibernatePersistentObjectDAO<SystemMessage> implements SystemMessageDAO { @Override public int getUnreadCount(String recipient, int type) { String sql = "select count(distinct(R.ld_messageid)) from ld_recipient R, ld_systemmessage M " + " where R.ld_name = '" + SqlUtil.doubleQuotes(recipient) + "' and R.ld_messageid=M.ld_id and M.ld_deleted=0 and M.ld_type=" + type + " and R.ld_read=0"; try { return queryForInt(sql); } catch (PersistenceException e) { log.error(e.getMessage(), e); return 0; } } HibernateSystemMessageDAO(); @Override List<SystemMessage> findByRecipient(String recipient, int type, Integer read); @Override int getUnreadCount(String recipient, int type); void deleteExpiredMessages(String recipient); void deleteExpiredMessages(int type); @Override List<SystemMessage> findByMode(String mode); @Override List<SystemMessage> findByType(int type); @Override void initialize(SystemMessage message); @Override List<SystemMessage> findMessagesToBeSent(int type, int maxTrial); @Override boolean store(SystemMessage message);  }### Answer:
@Test public void testGetUnreadCount() { Assert.assertEquals(1, dao.getUnreadCount("sebastian", SystemMessage.TYPE_SYSTEM)); Assert.assertEquals(2, dao.getUnreadCount("marco", 1)); Assert.assertEquals(0, dao.getUnreadCount("admin", SystemMessage.TYPE_SYSTEM)); }