### Question:
MailServiceImpl implements MailService { @Override public void sendHtmlMailWithFile(String[] to, String subject, String htmlText, String attachName, String attachment, boolean htmlenable) throws MessagingException { MimeMessageHelper helper = null; try { final MimeMessage message = emailSender.createMimeMessage(); if (attachment != null && attachName != null && attachName != "") { helper = new MimeMessageHelper(message, true); byte[] decode = Base64.decodeBase64(attachment); helper.addAttachment(attachName, new ByteArrayResource(decode)); } else { helper = new MimeMessageHelper(message); } helper.setTo(to); helper.setSubject(subject); helper.setText(htmlText, htmlenable); emailSender.send(message); } catch (final MessagingException e) { log.error("Error sending mail", e); log.error("If you are using GMail check https: throw e; } }  @Override void sendMail(String[] to, String subject, String text); @Override void sendMail(String to, String subject, String text); @Override void sendMailWithTemplate(String[] to, String subject, SimpleMailMessage template, String... templateArgs); @Override void sendMailWithTemplate(String to, String subject, SimpleMailMessage template, String... templateArgs); @Override void sendHtmlMailWithFile(String[] to, String subject, String htmlText, String attachName, String attachment,
			boolean htmlenable); @Override void sendHtmlMailWithFile(String to, String subject, String text, String attachmentName, String attachment,
	        boolean htmlenable); @Autowired
	public JavaMailSender emailSender; }### Answer:
@Test public void testSendMailWithAttachment() { try { String htmlMail = "<html><body>Here is application.yml<body></html>"; String base64data = "Q1AAAAiGsAAABAXAMAAIC4BgAAAHENAAAA4hoAAAAQ1wAAADAn/w8VUKiZ/Tt/9QAAAABJRU5ErkJggg=="; mailServiceImpl.sendHtmlMailWithFile("support@onesaitplatform.com", "Test", htmlMail, "Attachment.jpg", base64data, true); assertTrue("OK testSendMailWithAttachment", true); } catch (Exception e) { log.error("Exception reached " + e.getMessage(), e); Assert.fail("Error testSendMailWithAttachment"); } }