GerritProvider extends DefaultProvider { public int getCodeReviewValue(String result) { result = result == null ? "" : result; int value = IN_PROGRESS_VALUE; if (result.equalsIgnoreCase("Passed")) { value = SUCCESS_VALUE; } else if (result.equalsIgnoreCase("Failed")) { value = FAILURE_VALUE; } else if (result.equalsIgnoreCase("Cancelled")) { value = FAILURE_VALUE; } return value; } GerritProvider();  GerritProvider(HTTPClient httpClient); @Override String pluginId(); @Override String pollerPluginId(); @Override void updateStatus(String url, PluginSettings pluginSettings, String branch, String revision, String pipelineInstance,
                             String result, String trackbackURL); @Override List<Map<String, Object>> validateConfig(Map<String, Object> fields); @Override PluginSettings pluginSettings(Map<String, String> responseBodyMap); int getCodeReviewValue(String result); static final String PLUGIN_ID; static final String GERRIT_CS_POLLER_PLUGIN_ID; static final int IN_PROGRESS_VALUE; static final int SUCCESS_VALUE; static final int FAILURE_VALUE; }
@Test public void shouldGetStateFromResult() { assertThat(provider.getCodeReviewValue("Unknown"), is(GerritProvider.IN_PROGRESS_VALUE)); assertThat(provider.getCodeReviewValue("Passed"), is(GerritProvider.SUCCESS_VALUE)); assertThat(provider.getCodeReviewValue("Failed"), is(GerritProvider.FAILURE_VALUE)); assertThat(provider.getCodeReviewValue("Cancelled"), is(GerritProvider.FAILURE_VALUE)); }