@Test public void shouldTalkToPluginToGetPluginSettingsConfiguration() throws Exception { PluginSettingsConfiguration deserializedResponse = new PluginSettingsConfiguration(); when(pluginSettingsJSONMessageHandler().responseMessageForPluginSettingsConfiguration(RESPONSE_BODY)).thenReturn(deserializedResponse); PluginSettingsConfiguration response = notificationExtension.getPluginSettingsConfiguration(PLUGIN_ID); assertRequest(requestArgumentCaptor.getValue(), NOTIFICATION_EXTENSION, apiVersion(), PluginSettingsConstants.REQUEST_PLUGIN_SETTINGS_CONFIGURATION, null); verify(pluginSettingsJSONMessageHandler()).responseMessageForPluginSettingsConfiguration(RESPONSE_BODY); assertSame(response, deserializedResponse); }
@Before public void setUp() throws Exception { extension = mock(NotificationExtension.class); PluginSettingsConfiguration value = new PluginSettingsConfiguration(); value.add(new PluginSettingsProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false)); value.add(new PluginSettingsProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true)); when(extension.getPluginSettingsConfiguration("plugin1")).thenReturn(value); when(extension.getPluginSettingsView("plugin1")).thenReturn("some-html"); }
@Test public void shouldContinueWithBuildingPluginInfoWhenPluginSettingsIsNotProvidedByPlugin() throws Exception { GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false); when(extension.getPluginSettingsConfiguration("plugin1")).thenReturn(null); NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension) .pluginInfoFor(descriptor); assertThat(pluginInfo.getDescriptor(), is(descriptor)); assertThat(pluginInfo.getExtensionName(), is("notification")); assertNull(pluginInfo.getPluginSettings()); }