ColumnManagementView extends VerticalPanel { Widget removeCondition(final ConditionCol52 column) { return deleteAnchor(column.getHeader(), () -> { try { final Optional<GuidedDecisionTableView.Presenter> dtPresenter = presenter.getActiveDecisionTable(); if (dtPresenter.isPresent()) { dtPresenter.get().deleteColumn(column); } } catch (VetoDeletePatternInUseException veto) { presenter.getView().showUnableToDeleteColumnMessage(column); } catch (VetoException veto) { presenter.getView().showGenericVetoMessage(); } }); } ColumnManagementView(); @Inject  ColumnManagementView(final ManagedInstance<DeleteColumnManagementAnchorWidget> deleteColumnManagementAnchorWidgets); void init(final GuidedDecisionTableModellerView.Presenter presenter); void renderColumns(final Map<String, List<BaseColumn>> columnGroups);  }
@Test public void testRemoveCondition() throws Exception { Stream.of(ConditionCol52.class, BRLConditionColumn.class) .map(Mockito::mock) .forEach(column -> { final String columnHeader = "column header"; final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class); doReturn(Optional.of(decisionTablePresenter)).when(modellerPresenter).getActiveDecisionTable(); doReturn(columnHeader).when(column).getHeader(); view.removeCondition(column); verify(view).deleteAnchor(eq("column header"), commandCaptor.capture()); commandCaptor.getValue().execute(); try { verify(decisionTablePresenter).deleteColumn(column); } catch (VetoException veto) { fail("Deletion should have succeeded."); } reset(view); }); }