@Test public void start_withTwoFolderNames_shouldCreateTwoImapFolderPushersAndCallStart() throws Exception { List<String> folderNames = Arrays.asList("Important", "Drafts"); imapPusher.start(folderNames); List<ImapFolderPusher> imapFolderPushers = imapPusher.getImapFolderPushers(); assertEquals(2, imapFolderPushers.size()); ImapFolderPusher imapFolderPusherOne = imapFolderPushers.get(0); ImapFolderPusher imapFolderPusherTwo = imapFolderPushers.get(1); verify(imapFolderPusherOne).start(); verify(imapFolderPusherTwo).start(); }
@Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPusher(ImapStore store, PushReceiver pushReceiver); }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefreshInterval(); @Override long getLastRefresh(); @Override void setLastRefresh(long lastRefresh); }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefreshInterval(); @Override long getLastRefresh(); @Override void setLastRefresh(long lastRefresh);  }