### Question:
SMSCacheServiceImpl implements CacheService { public List<GatewayRequest> getMessagesByStatusAndSchedule(MStatus mStatus, Date date) { GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); return gatewayRequestDAO.getByStatusAndSchedule(mStatus, date); }  void saveMessage(GatewayRequest gatewayRequest); void mergeMessage(GatewayRequest gatewayRequest); void mergeMessage(MessageRequest messageRequest); void saveMessage(GatewayRequestDetails gatewayRequestDetails); void saveResponse(GatewayResponse gatewayResponse); List<GatewayRequest> getMessages(GatewayRequest gatewayRequest); List<GatewayRequest> getMessagesByStatus(MStatus mStatus); List<GatewayRequest> getMessagesByStatusAndSchedule(MStatus mStatus, Date date); List<GatewayResponse> getResponses(GatewayResponse gatewayResponse); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager);  }### Answer:
@Test public void testGetMessagesByStatusAndSchedule() { System.out.println("getMessagesByStatusAndSchedule"); mockMessageDAO = createMock(GatewayRequestDAO.class); expect( mockCore.createGatewayRequestDAO() ).andReturn(mockMessageDAO); expect( mockMessageDAO.getByStatusAndSchedule((MStatus) anyObject(), (Date) anyObject()) ).andReturn(new ArrayList<GatewayRequest>()); replay(mockCore, mockMessageDAO); List<GatewayRequest> result = instance.getMessagesByStatusAndSchedule(MStatus.CANCELLED, new Date()); assertNotNull(result); verify(mockCore, mockMessageDAO); }