### Question:
MessageDataSourceDAO extends DataSourceDAO implements MessageDAO { public int findInboxReadyMaxSequenceNoByCpa(MessageDVO data) throws DAOException { List l = super.find( "find_inbox_ready_max_sequence_no_by_cpa", new Object[] { data.getCpaId(), data.getService(), data.getAction(), data.getConvId() }); Iterator i = l.iterator(); if (i.hasNext()) { MessageDataSourceDVO resultData = (MessageDataSourceDVO) i.next(); return resultData.getSequenceNo(); } return -1; }  DVO createDVO(); boolean findMessage(MessageDVO data); void addMessage(MessageDVO data); void deleteMessage(MessageDVO data); boolean updateMessage(MessageDVO data); boolean findRefToMessage(MessageDVO data); List findMessagesByTime(int time_period, MessageDVO data, int numberOfMessage, int offset); List findMessagesBeforeTime(int time_period); List findInboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxProcessingMessagesByTimestamp(MessageDVO data); List findMessageByCpa(MessageDVO data, int numberOfMessage); int findInboxReadyMaxSequenceNoByCpa(MessageDVO data); int findMaxSequenceNoByMessageBoxAndCpa(MessageDVO data); int findMaxSequenceGroupByMessageBoxAndCpa(MessageDVO data); int findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup(
            MessageDVO data); boolean findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo(
            MessageDVO data); List findOrderedMessagesByMessageBoxAndCpaAndStatus(MessageDVO data); List findMessagesByHistory(MessageDVO data, int numberOfMessage,
            int offset); int findNumberOfMessagesByHistory(MessageDVO data); int updateTimedOutMessageStatus(String status, Date currentTime); int updateOldIncomingMessagesPendingbyTimestamp(String newhostname, String oldhostname); int updateOldOutboxPendingMessagesbyTimestamp(String newhostname, String oldhostname); int updateOldOutboxProcessingMessagesbyTimestamp(String newhostname, String oldhostname);  }### Answer:
@Test public void testFindInboxReadyMaxSequenceNoByCpa() throws DAOException { MessageDataSourceDAO dao = super.getTestingTarget(); MessageDVO dvo = (MessageDVO)dao.createDVO(); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setConvId("convId"); int currentSequenceNumber; dvo.setCpaId("cecid1"); currentSequenceNumber = dao.findInboxReadyMaxSequenceNoByCpa(dvo); Assert.assertEquals(-1, currentSequenceNumber); dvo.setCpaId("cecid2"); currentSequenceNumber = dao.findInboxReadyMaxSequenceNoByCpa(dvo); Assert.assertEquals(1, currentSequenceNumber); dvo.setCpaId("cecid3"); currentSequenceNumber = dao.findInboxReadyMaxSequenceNoByCpa(dvo); Assert.assertEquals(2, currentSequenceNumber); }