StashProvider extends DefaultProvider { public String getState(String result) { result = result == null ? "" : result; String state = IN_PROGRESS_STATE; if (result.equalsIgnoreCase("Passed")) { state = SUCCESSFUL_STATE; } else if (result.equalsIgnoreCase("Failed")) { state = FAILED_STATE; } else if (result.equalsIgnoreCase("Cancelled")) { state = FAILED_STATE; } return state; } StashProvider();  StashProvider(HTTPClient httpClient); @Override String pluginId(); @Override String pollerPluginId(); @Override void updateStatus(String url, PluginSettings pluginSettings, String branch, String revision, String pipelineStage,
                             String result, String trackbackURL); @Override List<Map<String, Object>> validateConfig(Map<String, Object> fields); String getState(String result); static final String PLUGIN_ID; static final String STASH_PR_POLLER_PLUGIN_ID; static final String IN_PROGRESS_STATE; static final String SUCCESSFUL_STATE; static final String FAILED_STATE; }
@Test public void shouldGetStateFromResult() { assertThat(provider.getState("Unknown"), is(StashProvider.IN_PROGRESS_STATE)); assertThat(provider.getState("Passed"), is(StashProvider.SUCCESSFUL_STATE)); assertThat(provider.getState("Failed"), is(StashProvider.FAILED_STATE)); assertThat(provider.getState("Cancelled"), is(StashProvider.FAILED_STATE)); }