@Test public void filterContributorsTest() { final InOrder order = inOrder(contributorsListItemPresenter); presenter.contributors = new ArrayList<>(); presenter.contributors.add(new Contributor("John", ContributorType.OWNER)); presenter.contributors.add(new Contributor("Mary", ContributorType.ADMIN)); presenter.contributors.add(new Contributor("Jonathan", ContributorType.CONTRIBUTOR)); presenter.filterContributors("h"); verify(view).clearContributors(); order.verify(contributorsListItemPresenter).setup(presenter.contributors.get(0), presenter, null); order.verify(contributorsListItemPresenter).setup(presenter.contributors.get(2), presenter, null); verify(view, times(2)).addContributor(any()); }
public void filterContributors(final String filter) { List<Contributor> filteredContributors = contributors.stream() .filter(c -> c.getUsername().toUpperCase().contains(filter.toUpperCase())) .collect(Collectors.toList()); updateView(filteredContributors); }
ContributorsListPresenter { public void filterContributors(final String filter) { List<Contributor> filteredContributors = contributors.stream() .filter(c -> c.getUsername().toUpperCase().contains(filter.toUpperCase())) .collect(Collectors.toList()); updateView(filteredContributors); } }
ContributorsListPresenter { public void filterContributors(final String filter) { List<Contributor> filteredContributors = contributors.stream() .filter(c -> c.getUsername().toUpperCase().contains(filter.toUpperCase())) .collect(Collectors.toList()); updateView(filteredContributors); } @Inject  ContributorsListPresenter(final View view,
                                     final ManagedInstance<ContributorsListItemPresenter> contributorsListItemPresenters,
                                     final Elemental2DomUtil elemental2DomUtil,
                                     final Promises promises); }
ContributorsListPresenter { public void filterContributors(final String filter) { List<Contributor> filteredContributors = contributors.stream() .filter(c -> c.getUsername().toUpperCase().contains(filter.toUpperCase())) .collect(Collectors.toList()); updateView(filteredContributors); } @Inject  ContributorsListPresenter(final View view,
                                     final ManagedInstance<ContributorsListItemPresenter> contributorsListItemPresenters,
                                     final Elemental2DomUtil elemental2DomUtil,
                                     final Promises promises); void setup(final ContributorsListService contributorsListService,
                      final Consumer<Integer> contributorsCountChangedCallback); void refresh(); void updateContributors(); void filterContributors(final String filter); void addContributor(); void itemIsBeingEdited(); void itemIsNotBeingEdited(); Promise<Boolean> canEditContributors(final ContributorType type); List<String> getValidUsernames(); View getView(); }
ContributorsListPresenter { public void filterContributors(final String filter) { List<Contributor> filteredContributors = contributors.stream() .filter(c -> c.getUsername().toUpperCase().contains(filter.toUpperCase())) .collect(Collectors.toList()); updateView(filteredContributors); } @Inject  ContributorsListPresenter(final View view,
                                     final ManagedInstance<ContributorsListItemPresenter> contributorsListItemPresenters,
                                     final Elemental2DomUtil elemental2DomUtil,
                                     final Promises promises); void setup(final ContributorsListService contributorsListService,
                      final Consumer<Integer> contributorsCountChangedCallback); void refresh(); void updateContributors(); void filterContributors(final String filter); void addContributor(); void itemIsBeingEdited(); void itemIsNotBeingEdited(); Promise<Boolean> canEditContributors(final ContributorType type); List<String> getValidUsernames(); View getView();  }