WorldpayUserDisplayNameAppender implements WorldpaySupportEmailAppender { @Override public String appendContent() { final String userName = userService.getCurrentUser().getDisplayName(); return System.lineSeparator() + "User: " + userName + System.lineSeparator(); }  @Override String appendContent(); @Required void setUserService(UserService userService);  }
@Test public void testAppendContent() throws Exception { when(userServiceMock.getCurrentUser()).thenReturn(userMock); when(userMock.getDisplayName()).thenReturn(USER_NAME); final String result = testObj.appendContent(); assertTrue(result.contains("User: " + USER_NAME)); }