assertErrorCode(Response.Status.NOT_FOUND,
IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? "Issue Does Not Exist"
: "The issue no longer exists.", new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "FAKEKEY-1", "Duplicate", null)).claim();
}
});
assertErrorCode(Response.Status.NOT_FOUND, "No issue link type with name 'NonExistingLinkType' found.", new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "TST-6", "NonExistingLinkType", null)).claim();
}
});
setUser1();
final String optionalDot = isJira5xOrNewer() ? "." : "";
assertErrorCode(Response.Status.NOT_FOUND,
"You do not have the permission to see the specified issue" + optionalDot, new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "RST-1", "Duplicate", null)).claim();
}
});
final ErrorCollection.Builder ecb = ErrorCollection.builder();
ecb.status(Response.Status.BAD_REQUEST.getStatusCode())
.errorMessage("Failed to create comment for issue 'TST-6'")
.error("commentLevel", "You are currently not a member of the project role: Administrators.");
final ImmutableList<ErrorCollection> errorCollections = ImmutableList.of(ecb.build());
assertExpectedErrorCollection(errorCollections, new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "TST-6", "Duplicate",
Comment.createWithRoleLevel("my body", "Administrators"))).claim();
}
});
assertErrorCode(Response.Status.BAD_REQUEST, "You are currently not a member of the group: jira-administrators.", new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "TST-6", "Duplicate",
Comment.createWithGroupLevel("my body", "jira-administrators"))).claim();
}
});
assertErrorCode(Response.Status.BAD_REQUEST, "Group: somefakegroup does not exist.", new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "TST-6", "Duplicate",
Comment.createWithGroupLevel("my body", "somefakegroup"))).claim();
}
});
setUser2();
assertErrorCode(Response.Status.UNAUTHORIZED, "No Link Issue Permission for issue 'TST-7'", new Runnable() {
@Override
public void run() {
client.getIssueClient().linkIssue(new LinkIssuesInput("TST-7", "TST-6", "Duplicate", null)).claim();
}
});
}