@Test @SuppressWarnings("unchecked") public void testOnSelectSelected() { final SelectableDocumentView selectableDocumentBean1 = mock( SelectableDocumentView.class ); final SelectableDocumentView selectableDocumentBean2 = mock( SelectableDocumentView.class ); final Path documentPath1 = mock( Path.class ); final Path documentPath2 = mock( Path.class ); when( selectableDocumentViewProvider.get() ).thenReturn( selectableDocumentBean1 ).thenReturn( selectableDocumentBean2 ); when( selectableDocumentBean1.getPath() ).thenReturn( documentPath1 ); when( selectableDocumentBean2.getPath() ).thenReturn( documentPath2 ); when( documentPath1.toURI() ).thenReturn( "default: when( documentPath2.toURI() ).thenReturn( "default: final List<Path> documents = new ArrayList<Path>() {{ add( documentPath1 ); add( documentPath2 ); }}; presenter.setDocuments( documents ); verify( selectableDocumentBean1, times( 1 ) ).setDocumentSelectedCommand( commandArgumentCaptor.capture() ); final ParameterizedCommand command = commandArgumentCaptor.getValue(); assertNotNull( command ); command.execute( true ); verify( selectableDocumentBean1, times( 1 ) ).setSelected( eq( true ) ); verify( selectableDocumentBean2, times( 1 ) ).setSelected( eq( false ) ); verify( view, times( 1 ) ).enableOKButton( eq( true ) ); }
@Override public void setDocuments(final List<Path> paths) { PortablePreconditions.checkNotNull("paths", paths); dispose(); for (Path path : paths) { final SelectableDocumentView document = makeSelectableDocument(path); selectableDocuments.add(document); view.addDocument(document); } view.enableOKButton(false); }
SelectDocumentPopup implements SelectDocumentPopupPresenter { @Override public void setDocuments(final List<Path> paths) { PortablePreconditions.checkNotNull("paths", paths); dispose(); for (Path path : paths) { final SelectableDocumentView document = makeSelectableDocument(path); selectableDocuments.add(document); view.addDocument(document); } view.enableOKButton(false); } }
SelectDocumentPopup implements SelectDocumentPopupPresenter { @Override public void setDocuments(final List<Path> paths) { PortablePreconditions.checkNotNull("paths", paths); dispose(); for (Path path : paths) { final SelectableDocumentView document = makeSelectableDocument(path); selectableDocuments.add(document); view.addDocument(document); } view.enableOKButton(false); } @Inject  SelectDocumentPopup(final SelectDocumentPopupView view,
                               final ManagedInstance<SelectableDocumentView> selectableDocumentProvider); }
SelectDocumentPopup implements SelectDocumentPopupPresenter { @Override public void setDocuments(final List<Path> paths) { PortablePreconditions.checkNotNull("paths", paths); dispose(); for (Path path : paths) { final SelectableDocumentView document = makeSelectableDocument(path); selectableDocuments.add(document); view.addDocument(document); } view.enableOKButton(false); } @Inject  SelectDocumentPopup(final SelectDocumentPopupView view,
                               final ManagedInstance<SelectableDocumentView> selectableDocumentProvider); @Override @PreDestroy void dispose(); @Override void setEditorPresenter(final KieMultipleDocumentEditorPresenter presenter); @Override void setDocuments(final List<Path> paths); @Override void show(); @Override void onOK(); @Override void onCancel(); }
SelectDocumentPopup implements SelectDocumentPopupPresenter { @Override public void setDocuments(final List<Path> paths) { PortablePreconditions.checkNotNull("paths", paths); dispose(); for (Path path : paths) { final SelectableDocumentView document = makeSelectableDocument(path); selectableDocuments.add(document); view.addDocument(document); } view.enableOKButton(false); } @Inject  SelectDocumentPopup(final SelectDocumentPopupView view,
                               final ManagedInstance<SelectableDocumentView> selectableDocumentProvider); @Override @PreDestroy void dispose(); @Override void setEditorPresenter(final KieMultipleDocumentEditorPresenter presenter); @Override void setDocuments(final List<Path> paths); @Override void show(); @Override void onOK(); @Override void onCancel();  }