ClearSessionsTask { @Scheduled(cron = "0 0 0 * * Sun") public void clearSessions() { sessionManager.clearSessions(); } @Autowired  ClearSessionsTask(SessionManager sessionManager); @Scheduled(cron = "0 0 0 * * Sun") void clearSessions();  }
@Test public void testClearSessions() throws Exception { clearSessionsTask.clearSessions(); verify(sessionManager, times(1)).clearSessions(); verifyNoMoreInteractions(sessionManager); }