@Test public void testSetup() { final GitUrl gitUrl = new GitUrl("git", "git-url"); final GitUrl sshUrl = new GitUrl("ssh", "ssh-url"); presenter.setup(Arrays.asList(gitUrl, sshUrl)); verify(presenter, times(1)).update(); verify(view, times(1)).setupProtocols(any(),any(), any()); assertEquals("ssh", presenter.selectedProtocol); assertEquals(2, presenter.gitUrlsByProtocol.size()); assertEquals(gitUrl, presenter.gitUrlsByProtocol.get("git")); assertEquals(sshUrl, presenter.gitUrlsByProtocol.get("ssh")); }
public void setup(final List<GitUrl> gitUrls) { gitUrlsByProtocol = gitUrls.stream().collect(toMap(GitUrl::getProtocol, identity())); selectedProtocol = gitUrlsByProtocol.containsKey(DEFAULT_SELECTED_PROTOCOL) ? DEFAULT_SELECTED_PROTOCOL : gitUrls.get(0).getProtocol(); view.setupProtocols(gitUrls.stream().map(GitUrl::getProtocol).map(p -> new KieSelectOption(p, p)).collect(toList()), selectedProtocol, this::setSelectedProtocol); update(); }
GitUrlsPresenter { public void setup(final List<GitUrl> gitUrls) { gitUrlsByProtocol = gitUrls.stream().collect(toMap(GitUrl::getProtocol, identity())); selectedProtocol = gitUrlsByProtocol.containsKey(DEFAULT_SELECTED_PROTOCOL) ? DEFAULT_SELECTED_PROTOCOL : gitUrls.get(0).getProtocol(); view.setupProtocols(gitUrls.stream().map(GitUrl::getProtocol).map(p -> new KieSelectOption(p, p)).collect(toList()), selectedProtocol, this::setSelectedProtocol); update(); } }
GitUrlsPresenter { public void setup(final List<GitUrl> gitUrls) { gitUrlsByProtocol = gitUrls.stream().collect(toMap(GitUrl::getProtocol, identity())); selectedProtocol = gitUrlsByProtocol.containsKey(DEFAULT_SELECTED_PROTOCOL) ? DEFAULT_SELECTED_PROTOCOL : gitUrls.get(0).getProtocol(); view.setupProtocols(gitUrls.stream().map(GitUrl::getProtocol).map(p -> new KieSelectOption(p, p)).collect(toList()), selectedProtocol, this::setSelectedProtocol); update(); } @Inject  GitUrlsPresenter(final View view,
                            final Event<NotificationEvent> notificationEventEvent,
                            final TranslationService translationService,
                            final Clipboard clipboard); }
GitUrlsPresenter { public void setup(final List<GitUrl> gitUrls) { gitUrlsByProtocol = gitUrls.stream().collect(toMap(GitUrl::getProtocol, identity())); selectedProtocol = gitUrlsByProtocol.containsKey(DEFAULT_SELECTED_PROTOCOL) ? DEFAULT_SELECTED_PROTOCOL : gitUrls.get(0).getProtocol(); view.setupProtocols(gitUrls.stream().map(GitUrl::getProtocol).map(p -> new KieSelectOption(p, p)).collect(toList()), selectedProtocol, this::setSelectedProtocol); update(); } @Inject  GitUrlsPresenter(final View view,
                            final Event<NotificationEvent> notificationEventEvent,
                            final TranslationService translationService,
                            final Clipboard clipboard); @PostConstruct void init(); void setup(final List<GitUrl> gitUrls); void setSelectedProtocol(final String selectedProtocol); void copyToClipboard(final HTMLInputElement element); View getView(); }
GitUrlsPresenter { public void setup(final List<GitUrl> gitUrls) { gitUrlsByProtocol = gitUrls.stream().collect(toMap(GitUrl::getProtocol, identity())); selectedProtocol = gitUrlsByProtocol.containsKey(DEFAULT_SELECTED_PROTOCOL) ? DEFAULT_SELECTED_PROTOCOL : gitUrls.get(0).getProtocol(); view.setupProtocols(gitUrls.stream().map(GitUrl::getProtocol).map(p -> new KieSelectOption(p, p)).collect(toList()), selectedProtocol, this::setSelectedProtocol); update(); } @Inject  GitUrlsPresenter(final View view,
                            final Event<NotificationEvent> notificationEventEvent,
                            final TranslationService translationService,
                            final Clipboard clipboard); @PostConstruct void init(); void setup(final List<GitUrl> gitUrls); void setSelectedProtocol(final String selectedProtocol); void copyToClipboard(final HTMLInputElement element); View getView();  }