@Test public void initTest() { NewResourceHandler packageHandler = mock(NewPackageHandler.class); doReturn(true).when(packageHandler).canCreate(); NewResourceHandler type1Handler = mock(NewResourceHandler.class); doReturn(true).when(type1Handler).canCreate(); NewResourceHandler type2Handler = mock(NewResourceHandler.class); doReturn(true).when(type2Handler).canCreate(); List<NewResourceHandler> handlers = new ArrayList<>(); handlers.add(packageHandler); handlers.add(type1Handler); handlers.add(type2Handler); doReturn(handlers).when(resourceUtils).getAlphabeticallyOrderedNewResourceHandlers(); presenter.init(); verify(view, times(3)).addResourceHandler(any(NewResourceHandler.class)); verify(view).addResourceHandler(packageHandler); verify(view).addResourceHandler(type1Handler); verify(view).addResourceHandler(type2Handler); }
public void init() { view.init(this); resourceUtils.getAlphabeticallyOrderedNewResourceHandlers().stream().filter(newResourceHandler -> newResourceHandler.canCreate() && !isProjectHandler(newResourceHandler)).forEach(newResourceHandler -> view.addResourceHandler(newResourceHandler)); }
AssetsActionsWidget { public void init() { view.init(this); resourceUtils.getAlphabeticallyOrderedNewResourceHandlers().stream().filter(newResourceHandler -> newResourceHandler.canCreate() && !isProjectHandler(newResourceHandler)).forEach(newResourceHandler -> view.addResourceHandler(newResourceHandler)); } }
AssetsActionsWidget { public void init() { view.init(this); resourceUtils.getAlphabeticallyOrderedNewResourceHandlers().stream().filter(newResourceHandler -> newResourceHandler.canCreate() && !isProjectHandler(newResourceHandler)).forEach(newResourceHandler -> view.addResourceHandler(newResourceHandler)); } @Inject  AssetsActionsWidget(final View view,
                               final NewResourcePresenter newResourcePresenter,
                               final ResourceUtils resourceUtils); }
AssetsActionsWidget { public void init() { view.init(this); resourceUtils.getAlphabeticallyOrderedNewResourceHandlers().stream().filter(newResourceHandler -> newResourceHandler.canCreate() && !isProjectHandler(newResourceHandler)).forEach(newResourceHandler -> view.addResourceHandler(newResourceHandler)); } @Inject  AssetsActionsWidget(final View view,
                               final NewResourcePresenter newResourcePresenter,
                               final ResourceUtils resourceUtils); void init(); NewResourcePresenter getNewResourcePresenter(); View getView(); }
AssetsActionsWidget { public void init() { view.init(this); resourceUtils.getAlphabeticallyOrderedNewResourceHandlers().stream().filter(newResourceHandler -> newResourceHandler.canCreate() && !isProjectHandler(newResourceHandler)).forEach(newResourceHandler -> view.addResourceHandler(newResourceHandler)); } @Inject  AssetsActionsWidget(final View view,
                               final NewResourcePresenter newResourcePresenter,
                               final ResourceUtils resourceUtils); void init(); NewResourcePresenter getNewResourcePresenter(); View getView();  }