### Question:
SMSCacheServiceImpl implements CacheService { public void saveMessage(GatewayRequest gatewayRequest) { logger.debug("Initializing DAO"); GatewayRequestDAO gatewayRequestDAO = coreManager.createGatewayRequestDAO(); logger.debug("Caching message"); logger.debug(gatewayRequest); gatewayRequestDAO.save(gatewayRequest); }  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 testSaveMessage() { System.out.println("saveMessage"); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.setDateTo(new Date()); messageDetails.setRecipientsNumber("000000000000"); messageDetails.setGatewayRequestDetails(mockGatewayRequestDetails); messageDetails.setMessageStatus(MStatus.PENDING); mockMessageDAO = createMock(GatewayRequestDAO.class); expect( mockCore.createGatewayRequestDAO() ).andReturn(mockMessageDAO); expect( mockMessageDAO.save(messageDetails) ).andReturn(messageDetails); replay(mockCore, mockMessageDAO); instance.saveMessage(messageDetails); verify(mockCore, mockMessageDAO); }