WorldpayAddonVersionAppender implements WorldpaySupportEmailAppender { @Override public String appendContent() { final String addonVersion = configurationService.getConfiguration().getString(WORLDPAY_ADDON_VERSION_KEY); if (StringUtils.isBlank(addonVersion)) { return StringUtils.EMPTY; } return format("{0}Worldpay Plugin Version: {1}{0}", System.lineSeparator(), addonVersion); }  @Override String appendContent(); @Required void setConfigurationService(ConfigurationService configurationService);  }
@Test public void shouldReturnAddonVersionContentToAppend() { when(configurationServiceMock.getConfiguration().getString(WORLDPAY_ADDON_VERSION_KEY)).thenReturn(ADDON_VERSION); final String result = testObj.appendContent(); assertTrue(result.contains("Worldpay Plugin Version: " + ADDON_VERSION)); }
@Test public void shouldReturnNoContentToAppendWhenAddonVersionIsUnknown() { when(configurationServiceMock.getConfiguration().getString(WORLDPAY_ADDON_VERSION_KEY)).thenReturn(EMPTY); final String result = testObj.appendContent(); assertTrue(result.isEmpty()); }