@Test public void testHandleRequestInvalidIssueKey() throws InterruptedException { JsonElement comment = new JsonPrimitive(TestHelper.comment); JsonElement currentUser = new JsonPrimitive(TestHelper.assigneeName); String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); Thread.sleep(2000); BentenHandlerResponse bentenHandlerResponse = jiraCommentActionHandler.handle(MessageBuilder .constructBentenCommentMessage(new JsonPrimitive("INVALID-123"),comment,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 currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.comment(issueKey, comment, currentUser); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.commentMessage(issueKey)); }catch(BentenJiraException e){ bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":")+1))); }catch (Exception e){ throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }
JiraCommentActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_ISSUE_KEY); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.comment(issueKey, comment, currentUser); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.commentMessage(issueKey)); }catch(BentenJiraException e){ bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":")+1))); }catch (Exception e){ throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; } }
JiraCommentActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_ISSUE_KEY); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.comment(issueKey, comment, currentUser); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.commentMessage(issueKey)); }catch(BentenJiraException e){ bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.errorMessage(e.getMessage().substring(e.getMessage().lastIndexOf(":")+1))); }catch (Exception e){ throw new BentenJiraException(e.getMessage()); } return bentenHandlerResponse; }  }
JiraCommentActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_ISSUE_KEY); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.comment(issueKey, comment, currentUser); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.commentMessage(issueKey)); }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); }
JiraCommentActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_ISSUE_KEY); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.CURRENT_USER); String comment = BentenMessageHelper.getParameterAsString(bentenMessage, SlackConstants.COMMENT); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { bentenJiraClient.comment(issueKey, comment, currentUser); bentenHandlerResponse .setBentenSlackResponse(SlackMessageRenderer.commentMessage(issueKey)); }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);  }