@Test public void testHandleRequestInvalidIssueKey() throws InterruptedException { String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); JsonElement time = new JsonPrimitive("3h 4m"); JsonElement currentUser = new JsonPrimitive(TestHelper.assigneeName); Thread.sleep(2000); BentenHandlerResponse bentenHandlerResponse = jiraLogWorkActionHandler.handle(MessageBuilder .constructBentenLogWorkMessage(new JsonPrimitive("INVALID-1001"),time,currentUser)); Assert.assertNotNull(bentenHandlerResponse.getBentenSlackResponse()); Assert.assertNotNull(bentenHandlerResponse.getBentenSlackResponse().getSlackText()); Assert.assertTrue(bentenHandlerResponse.getBentenSlackResponse().getSlackText().contains("Issue Does Not Exist")); }
public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_ISSUE_KEY); String time = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_TIME); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.logWork(issueKey, time, currentUser, comment); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.logWorkMessage(issueKey, time)); } catch (BentenJiraException e) { bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":") + 1))); } catch (Exception e) { throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }
JiraLogWorkActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_ISSUE_KEY); String time = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_TIME); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.logWork(issueKey, time, currentUser, comment); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.logWorkMessage(issueKey, time)); } catch (BentenJiraException e) { bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":") + 1))); } catch (Exception e) { throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; } }
JiraLogWorkActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_ISSUE_KEY); String time = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_TIME); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.logWork(issueKey, time, currentUser, comment); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.logWorkMessage(issueKey, time)); } catch (BentenJiraException e) { bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":") + 1))); } catch (Exception e) { throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }  }
JiraLogWorkActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_ISSUE_KEY); String time = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_TIME); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.logWork(issueKey, time, currentUser, comment); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.logWorkMessage(issueKey, time)); } catch (BentenJiraException e) { bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":") + 1))); } catch (Exception e) { throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }  BentenHandlerResponse handle(BentenMessage bentenMessage); }
JiraLogWorkActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_ISSUE_KEY); String time = BentenMessageHelper.getParameterAsString(bentenMessage, JiraActionParameters.PARAMETER_TIME); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.logWork(issueKey, time, currentUser, comment); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.logWorkMessage(issueKey, time)); } catch (BentenJiraException e) { bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":") + 1))); } catch (Exception e) { throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }  BentenHandlerResponse handle(BentenMessage bentenMessage);  }