@Test
  public void shouldNotGetPluginSettingsForPluginThatDoesNotExistInDB() {
    when(pluginDescriptor.id()).thenReturn("plugin-foo-id");
    when(pluginSqlMapDao.findPlugin("plugin-foo-id")).thenReturn(new NullPlugin());
    String requestBody = "expected-request";
    when(jsonMessageHandler.responseMessagePluginSettingsGet(any(PluginSettings.class)))
        .thenReturn(null);

    DefaultGoApiRequest apiRequest =
        new DefaultGoApiRequest(PluginSettingsRequestProcessor.GET_PLUGIN_SETTINGS, "1.0", null);
    apiRequest.setRequestBody(requestBody);
    GoApiResponse response = processor.process(pluginDescriptor, apiRequest);

    assertThat(response.responseCode(), is(200));
    assertThat(response.responseBody(), is(nullValue()));
  }
  @Test
  public void shouldGetPluginSettingsForPluginThatExistsInDB() {
    when(pluginDescriptor.id()).thenReturn("plugin-foo-id");
    when(pluginSqlMapDao.findPlugin("plugin-foo-id"))
        .thenReturn(new Plugin("plugin-foo-id", "{\"k1\": \"v1\",\"k2\": \"v2\"}"));

    String requestBody = "expected-request";
    String responseBody = "expected-response";
    when(jsonMessageHandler.responseMessagePluginSettingsGet(requestArgumentCaptor.capture()))
        .thenReturn(responseBody);

    DefaultGoApiRequest apiRequest =
        new DefaultGoApiRequest(PluginSettingsRequestProcessor.GET_PLUGIN_SETTINGS, "1.0", null);
    apiRequest.setRequestBody(requestBody);
    GoApiResponse response = processor.process(pluginDescriptor, apiRequest);

    assertThat(response.responseCode(), is(200));
    assertThat(response.responseBody(), is(responseBody));

    Map<String, String> settingsMap = new HashMap<String, String>();
    settingsMap.put("k1", "v1");
    settingsMap.put("k2", "v2");
    assertEquals(requestArgumentCaptor.getValue().getSettingsAsKeyValuePair(), settingsMap);
  }