### Question:
JiraSearchIssuesByUserActionHandler implements BentenActionHandler { public BentenHandlerResponse handle(BentenMessage bentenMessage) { String userOfInterest= BentenMessageHelper.getParameterAsString(bentenMessage,SlackConstants.USER_OF_INTEREST); String currentUser = BentenMessageHelper.getParameterAsString(bentenMessage,SlackConstants.CURRENT_USER); int noOfIssues = 10; String assignee; if(userOfInterest!=null){ assignee=userOfInterest; } else{ assignee=currentUser; } String expandedFields = Field.ASSIGNEE .concat(","+Field.STATUS) .concat(","+Field.PRIORITY) .concat(","+Field.ISSUE_TYPE) .concat(","+Field.PRIORITY) .concat(","+Field.SUMMARY); BentenHandlerResponse bentenHandlerResponse = new BentenHandlerResponse(); try { List<Issue> issues = bentenJiraClient.searchIssuesByAssignee(assignee, expandedFields, noOfIssues); BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(SlackMessageRenderer.renderIssueList(issues)); bentenHandlerResponse.setBentenSlackResponse(bentenSlackResponse); }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);  }### Answer:
@Test public void testHandleRequestCurrentUser(){ JsonElement currentUser = new JsonPrimitive(TestHelper.assigneeName); String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); String anotherIssueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,anotherIssueKey); BentenHandlerResponse bentenHandlerResponse = jiraSearchIssuesByUserActionHandler.handle(MessageBuilder.constructBentenMessage(currentUser,null)); List<Issue> issues = bentenJiraClient.searchIssuesByAssignee(TestHelper.assigneeName,TestHelper.expandedFields,10); Assert.assertNotNull(bentenHandlerResponse.getBentenSlackResponse().getSlackText()); Assert.assertTrue(issues.size() > 0); Assert.assertTrue(bentenHandlerResponse.getBentenSlackResponse().getSlackText().contains(TestHelper.project_key+"-1")); Assert.assertTrue(bentenHandlerResponse.getBentenSlackResponse().getSlackText().contains(TestHelper.project_key+"-2")); }
@Test public void testHandleRequestUserOfInterest(){ JsonElement userOfInterest = new JsonPrimitive("dungatla"); JsonElement currentUser = new JsonPrimitive(TestHelper.assigneeName); String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); String anotherIssueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,anotherIssueKey); BentenHandlerResponse bentenHandlerResponse = jiraSearchIssuesByUserActionHandler.handle(MessageBuilder.constructBentenMessage(currentUser,userOfInterest)); Assert.assertNotNull(bentenHandlerResponse.getBentenSlackResponse().getSlackText()); Assert.assertTrue(bentenHandlerResponse.getBentenSlackResponse().getSlackText().contains(issueKey)); Assert.assertTrue(bentenHandlerResponse.getBentenSlackResponse().getSlackText().contains(anotherIssueKey)); }