### Question:
MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.getLanguage(), messageData.getNotificationType(), messageData.getMessageType(), defaultLang); if (template == null) throw new MotechException("No such NotificationType found"); return template.getTemplate(); }  GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang); String parseTemplate(String template, Set<NameValuePair> templateParams); String formatPhoneNumber(String requesterPhone, MessageType type); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); void setMaxConcat(int maxConcat); void setCharsPerSMS(int charsPerSMS); void setConcatAllowance(int concatAllowance); void setLocalNumberExpression(String localNumberExpression); void setDefaultCountryCode(String defaultCountryCode); void setApplicationContext(ApplicationContext applicationContext);  }### Answer:
@Test public void testFetchTemplate() { System.out.println("fetchTemplate"); mockTemplateDao = createMock(MessageTemplateDAO.class); MessageRequest message = new MessageRequestImpl(); Language defaultLang = new LanguageImpl(); message.setNotificationType(new NotificationTypeImpl()); expect( mockCore.createMessageTemplateDAO() ).andReturn(mockTemplateDao); expect( mockTemplateDao.getTemplateByLangNotifMType((Language)anyObject(), (NotificationType) anyObject(), (MessageType) anyObject(), (Language) anyObject()) ).andReturn(template); replay(mockCore, mockTemplateDao); String result = instance.fetchTemplate(message, defaultLang); assertEquals(result, "testing"); verify(mockCore, mockTemplateDao); }