use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsJsonMessageHandler2_0 in project gocd by gocd.
the class AbstractExtensionTest method shouldNotifySettingsChangeForPluginWhichSupportsNotification.
@Test
public void shouldNotifySettingsChangeForPluginWhichSupportsNotification() throws Exception {
String supportedVersion = "2.0";
Map<String, String> settings = Collections.singletonMap("foo", "bar");
ArgumentCaptor<GoPluginApiRequest> requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
extension.registerHandler(supportedVersion, new PluginSettingsJsonMessageHandler2_0());
when(pluginManager.resolveExtensionVersion(pluginId, extensionName, goSupportedVersions)).thenReturn(supportedVersion);
when(pluginManager.submitTo(eq(pluginId), eq(extensionName), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, ""));
extension.notifyPluginSettingsChange(pluginId, settings);
assertRequest(requestArgumentCaptor.getValue(), extensionName, supportedVersion, REQUEST_NOTIFY_PLUGIN_SETTINGS_CHANGE, "{\"foo\":\"bar\"}");
}
Aggregations