### Question:
TaskLogger implements CliLogger { @Override public void enableSendStompMessage(Integer taskId, SimpMessagingTemplate messagingTemplate, String destinationPrefix) { Assert.notNull(taskId, "taskId 不能为空"); this.sendMessage = true; this.taskId = taskId; this.destinationPrefix = destinationPrefix; this.simpMessagingTemplate = messagingTemplate; } TaskLogger(Path logFile); @Override void enableSendStompMessage(Integer taskId, SimpMessagingTemplate messagingTemplate, String destinationPrefix); @Override void error(Throwable e); @Override void error(String pattern, Object... arguments); @Override void info(String pattern, Object... arguments); @Override void newLine(); @Override void log(String pattern, Object... arguments); @Override void log(String content); @Override void finished(ReleaseResult releaseResult);  }### Answer:
@Test public void enableSendStompMessage() { MockitoAnnotations.initMocks(this); CliLogger logger = new TaskLogger(logFile); SimpMessagingTemplate messagingTemplate = mock(SimpMessagingTemplate.class); logger.enableSendStompMessage(1, messagingTemplate, "/topic/publish/"); String message = "abc"; logger.log(message); verify(messagingTemplate).convertAndSend(eq("/topic/publish/1"), messageCaptor.capture()); }