### Question:
JiraIssueCreator implements IssueCreator { Map getIssueParameters() { issueParams = new HashMap(); try { String projectKey = new JiraItem("jira1.getProjects", null, properties.getProperty("jira.project")).get("key"); issueParams.put("project", projectKey); issueParams.put("type", new JiraItem("jira1.getIssueTypes", null, properties.getProperty("jira.issueType")).get("id")); issueParams.put("priority", new JiraItem("jira1.getPriorities", null, properties.getProperty("jira.priority")).get("id")); issueParams.put("assignee", properties.getProperty("jira.assignee")); List param = new ArrayList(); param.add(projectKey); issueParams.put("components", new JiraItem("jira1.getComponents", param, properties.getProperty("jira.component")).getMapInList("id")); if (!Utils.isBlankOrNull(properties.getProperty("jira.affectsVersions"))) { issueParams.put("affectsVersions", new JiraItem("jira1.getVersions", param, properties.getProperty("jira.affectsVersions")).getMapInList("id")); } if (!Utils.isBlankOrNull(properties.getProperty("jira.fixVersions"))) { issueParams.put("fixVersions", new JiraItem("jira1.getVersions", param, properties.getProperty("jira.fixVersions")).getMapInList("id")); } } catch (XmlRpcException e) { throw new RuntimeException(e); } return issueParams; } JiraIssueCreator(final String propFile);   JiraIssueCreator(XmlRpcClient rpcClient); static void main(String[] args); void createIssue(Issue issue); void logout(); String getLoginToken(); void login();  }### Answer:
@Test public void testGetIssueParametersWithParameterNotFound() throws Exception { try { mockXmlRpcClient.expects(once()).method("execute").with(eq("jira1.getProjects"), ANYTHING).will(returnValue(new Object[0])); issueCreator.getIssueParameters(); fail("Should throw RuntimeException"); } catch (RuntimeException e) { assertTrue(true); } }
@SuppressWarnings("unchecked") @Test public void testGetIssueParametersWithParameterFound() throws Exception { mockXmlRpcClient.expects(once()).method("execute").with(eq("jira1.getProjects"), ANYTHING).will(returnValue(new Object[]{getParamMap("Sahi Integration")})); mockXmlRpcClient.expects(once()).method("execute").with(eq("jira1.getIssueTypes"), ANYTHING).will(returnValue(new Object[]{getParamMap("Sahi Bug")})); mockXmlRpcClient.expects(once()).method("execute").with(eq("jira1.getPriorities"), ANYTHING).will(returnValue(new Object[]{getParamMap("Major")})); mockXmlRpcClient.expects(once()).method("execute").with(eq("jira1.getComponents"), ANYTHING).will(returnValue(new Object[]{getParamMap("Regression")})); mockXmlRpcClient.expects(atLeastOnce()).method("execute").with(eq("jira1.getVersions"), ANYTHING).will(returnValue(new Object[]{getParamMap("0.1")})); Map issueParams = issueCreator.getIssueParameters(); assertTrue(issueParams.containsKey("project")); assertTrue(issueParams.containsKey("type")); assertTrue(issueParams.containsKey("priority")); assertTrue(issueParams.containsKey("assignee")); assertTrue(issueParams.containsKey("components")); }