@Test
public void getSubjectAndTextReturnsExpectedSubjectAndText() {

    // given
    var expectedSubject = "Cool subject!";
    var expectedText = "Even cooler text!";
    var expectedResult = new Pair<>(expectedSubject, expectedText);
    var templatePath = "TestTemplate.vm";
    var templateContent = String.format("%s\r\n%s\r\n%s\r\n%s",
            VelocityMailTemplateService.SUBJECT_DELIMITER, expectedSubject,
            VelocityMailTemplateService.TEXT_DELIMITER, expectedText);
    var contextMap = Map.<String, Object>of("key", "value");
    given(velocityEngineMock.getTemplate(templatePath)).willReturn(velocityTemplateMock);
    doAnswer(invocation -> {
        var actualWriter = (StringWriter) invocation.getArgument(1);
        actualWriter.append(templateContent);
        return null;
    }).when(velocityTemplateMock).merge(
            argThat(new VelocityContextArgumentMatcher(contextMap)),
            argThat(new StringWriterArgumentMatcher(""))
    );
    // when
    var actualResult = velocityMailTemplateService.getSubjectAndText(templatePath, contextMap);
    // then
    assertThat(actualResult).isEqualTo(expectedResult);
}