@Test public void initConfigurationTab() { ToolkitView view = mock(ToolkitView.class); ToolkitPresenter presenter = new ToolkitPresenter(mock(ConfigurationModel.class), mock(SourceCodeModel.class)); presenter.setView(view); presenter.initConfigurationTab(); verify(view, never()).addConfigurationProperty(Mockito.anyString(), Mockito.anyString()); verify(view, never()).setConfigurationPropertyValue(Mockito.anyString(), Mockito.anyString()); ConfigurationProperty property1 = mock(ConfigurationProperty.class); when(property1.getName()).thenReturn("property1"); when(property1.getDescription()).thenReturn("description1"); when(property1.getValue()).thenReturn("default1"); ConfigurationProperty property2 = mock(ConfigurationProperty.class); when(property2.getName()).thenReturn("property2"); when(property2.getDescription()).thenReturn("description2"); when(property2.getValue()).thenReturn("default2"); ConfigurationModel configurationModel = mock(ConfigurationModel.class); when(configurationModel.getProperties()).thenReturn(ImmutableList.of(property1, property2)); presenter = new ToolkitPresenter(configurationModel, mock(SourceCodeModel.class)); presenter.setView(view); presenter.initConfigurationTab(); verify(view).addConfigurationProperty("property1", "description1"); verify(view).setConfigurationPropertyValue("property1", "default1"); verify(view).addConfigurationProperty("property2", "description2"); verify(view).setConfigurationPropertyValue("property2", "default2"); }
void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
ToolkitPresenter { void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } } }
ToolkitPresenter { void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } } ToolkitPresenter(ConfigurationModel configurationModel, SourceCodeModel model); }
ToolkitPresenter { void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } } ToolkitPresenter(ConfigurationModel configurationModel, SourceCodeModel model); void setView(ToolkitView view); void run(String title); void onSourceCodeOpenButtonClick(); void onSourceCodeParseButtonClick(); void onXPathEvaluateButtonClick(); void onSourceCodeKeyTyped(); void onSourceCodeTextCursorMoved(); void onAstSelectionChanged(); void onConfigurationPropertyFocusLost(String name); }
ToolkitPresenter { void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } } ToolkitPresenter(ConfigurationModel configurationModel, SourceCodeModel model); void setView(ToolkitView view); void run(String title); void onSourceCodeOpenButtonClick(); void onSourceCodeParseButtonClick(); void onXPathEvaluateButtonClick(); void onSourceCodeKeyTyped(); void onSourceCodeTextCursorMoved(); void onAstSelectionChanged(); void onConfigurationPropertyFocusLost(String name);  }