Code example for AbstractTransactionalTestNGSpringContextTests

Methods: mock

0
 * 
 * @author vitaly.yakunin 
 */ 
@ContextConfiguration(locations = {"classpath:applicationContext-test.xml","classpath:dozer-application-context-test.xml"}) 
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) 
public class MailServiceTest extends AbstractTransactionalTestNGSpringContextTests { 
    @Autowired 
    private MailService mailService; 
 
    @Autowired 
    private NotificationService sysMessageService; 
 
    @Autowired 
    private UserDataService userDataService; 
 
    @Autowired 
    private MailTemplateService mailTemplateService; 
 
    private final static String tmplBody = "Dear [firstName] [lastName]: \n\n" + 
            "This is to notify you that the request summarized below has been approved. \n\n" + 
            "\n\n" + 
            "Request ID: [requestId] \n" + 
            "Request Type: [requestReason] \n" + 
            "Approver: [requester] \n" + 
            "For: [targetUser] \n\n" + 
            "A new user account has been created for [targetUser]\n" + 
            "The login Id is: [identity]\n" + 
            "The initial password is: [password]"; 
 
    private final static String tmplHtmlBody = "<html><b>Dear</b> [firstName] [lastName]: \n\n" + 
            "<div style='color:red;'>This is to notify you that the request summarized below has been approved.</div> \n\n" + 
            "\n\n" + 
            "Request ID: [requestId] \n" + 
            "Request Type: [requestReason] \n" + 
            "Approver: [requester] \n" + 
            "For: [targetUser] \n\n" + 
            "A new user account has been created for [targetUser]\n" + 
            "The login Id is: [identity]\n" + 
            "The initial password is: [password] </html>"; 
 
    private UserDataWebService userWS = mock(UserDataWebService.class); 
    private User user; 
    private MailTemplateDto mailTemplateDto; 
 
    @BeforeMethod 
    public void init() {