* @throws RedmineAuthenticationException thrown in case something went wrong while trying to login
* @throws NotFoundException thrown in case the objects requested for could not be found
*/
@Test
public void testCreateAndGetIssueWithCategory() throws RedmineException {
IssueCategory newIssueCategory = null;
Issue newIssue = null;
try {
Project project = projectManager.getProjectByKey(projectKey);
// create an issue category
IssueCategory category = IssueCategoryFactory.create(project, "Category_"
+ new Date().getTime());
category.setAssignee(IntegrationTestHelper.getOurUser());
newIssueCategory = issueManager.createCategory(category);
// create an issue
Issue issueToCreate = IssueFactory.createWithSubject("getIssueWithCategory_" + UUID.randomUUID());
issueToCreate.setCategory(newIssueCategory);
newIssue = issueManager.createIssue(projectKey, issueToCreate);
// retrieve issue
Issue retrievedIssue = issueManager.getIssueById(newIssue.getId());
// assert retrieved category of issue
IssueCategory retrievedCategory = retrievedIssue.getCategory();
assertNotNull("Category retrieved for issue " + newIssue.getId()
+ " should not be null", retrievedCategory);
assertEquals("ID of category retrieved for issue "
+ newIssue.getId() + " is wrong", newIssueCategory.getId(),
retrievedCategory.getId());
assertEquals("Name of category retrieved for issue "
+ newIssue.getId() + " is wrong",
newIssueCategory.getName(), retrievedCategory.getName());
} finally {
if (newIssue != null) {
issueManager.deleteIssue(newIssue.getId());
}
if (newIssueCategory != null) {