@Test public void setupWithoutMasterSelectedTest() { final ImportProject importProject = mock(ImportProject.class); final List<String> branches = new ArrayList<>(); branches.add("branch1"); doReturn(branches).when(importProject).getSelectedBranches(); final HTMLElement branchSelectorContainer = mock(HTMLElement.class); doReturn(branchSelectorContainer).when(view).getBranchSelectorContainer(); presenter.setup(importProject, mock(Consumer.class)); verify(view).init(presenter); verify(branchSelector).setup(same(branchSelectorContainer), any(), eq(Arrays.asList("branch1", "master")), any()); verify(view).show(); verify(presenter.branchesSelectedCallback, never()).accept(anyList()); }
public void setup(final ImportProject importProject, final Consumer<List<String>> branchesSelectedCallback) { this.importProject = importProject; this.branchesSelectedCallback = branchesSelectedCallback; final List<String> allBranches = importProject.getAllBranches(); allBranches.sort(String.CASE_INSENSITIVE_ORDER); view.init(this); this.branches = importProject.getSelectedBranches(); this.branches.sort(String.CASE_INSENSITIVE_ORDER); if (!this.branches.contains("master")) { this.branches.add("master"); } branchSelector.setup(view.getBranchSelectorContainer(), allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()), this.branches, this::setSelectedBranches); view.show(); }
BranchSelectorPopUpPresenter { public void setup(final ImportProject importProject, final Consumer<List<String>> branchesSelectedCallback) { this.importProject = importProject; this.branchesSelectedCallback = branchesSelectedCallback; final List<String> allBranches = importProject.getAllBranches(); allBranches.sort(String.CASE_INSENSITIVE_ORDER); view.init(this); this.branches = importProject.getSelectedBranches(); this.branches.sort(String.CASE_INSENSITIVE_ORDER); if (!this.branches.contains("master")) { this.branches.add("master"); } branchSelector.setup(view.getBranchSelectorContainer(), allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()), this.branches, this::setSelectedBranches); view.show(); } }
BranchSelectorPopUpPresenter { public void setup(final ImportProject importProject, final Consumer<List<String>> branchesSelectedCallback) { this.importProject = importProject; this.branchesSelectedCallback = branchesSelectedCallback; final List<String> allBranches = importProject.getAllBranches(); allBranches.sort(String.CASE_INSENSITIVE_ORDER); view.init(this); this.branches = importProject.getSelectedBranches(); this.branches.sort(String.CASE_INSENSITIVE_ORDER); if (!this.branches.contains("master")) { this.branches.add("master"); } branchSelector.setup(view.getBranchSelectorContainer(), allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()), this.branches, this::setSelectedBranches); view.show(); } @Inject  BranchSelectorPopUpPresenter(final View view,
                                        final KieMultipleSelectElement branchSelector); }
BranchSelectorPopUpPresenter { public void setup(final ImportProject importProject, final Consumer<List<String>> branchesSelectedCallback) { this.importProject = importProject; this.branchesSelectedCallback = branchesSelectedCallback; final List<String> allBranches = importProject.getAllBranches(); allBranches.sort(String.CASE_INSENSITIVE_ORDER); view.init(this); this.branches = importProject.getSelectedBranches(); this.branches.sort(String.CASE_INSENSITIVE_ORDER); if (!this.branches.contains("master")) { this.branches.add("master"); } branchSelector.setup(view.getBranchSelectorContainer(), allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()), this.branches, this::setSelectedBranches); view.show(); } @Inject  BranchSelectorPopUpPresenter(final View view,
                                        final KieMultipleSelectElement branchSelector); void setup(final ImportProject importProject,
                      final Consumer<List<String>> branchesSelectedCallback); void defineBranches(); void cancel(); void setSelectedBranches(final List<String> branches); }
BranchSelectorPopUpPresenter { public void setup(final ImportProject importProject, final Consumer<List<String>> branchesSelectedCallback) { this.importProject = importProject; this.branchesSelectedCallback = branchesSelectedCallback; final List<String> allBranches = importProject.getAllBranches(); allBranches.sort(String.CASE_INSENSITIVE_ORDER); view.init(this); this.branches = importProject.getSelectedBranches(); this.branches.sort(String.CASE_INSENSITIVE_ORDER); if (!this.branches.contains("master")) { this.branches.add("master"); } branchSelector.setup(view.getBranchSelectorContainer(), allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()), this.branches, this::setSelectedBranches); view.show(); } @Inject  BranchSelectorPopUpPresenter(final View view,
                                        final KieMultipleSelectElement branchSelector); void setup(final ImportProject importProject,
                      final Consumer<List<String>> branchesSelectedCallback); void defineBranches(); void cancel(); void setSelectedBranches(final List<String> branches);  }