How to get IssueLink for MockIssue? (Atlassian JIRA 4.4 API)

I am experiencing great difficulty making an IssueLink for some mock issues...

to be clear, I am speaking of:

and NOT:


(which seems to have little purpose in 4.4, but much more in 5.x)

I am looking for a simple, straight forward, non-spring, pojo-esque approach to getting an IssueLink for my junits. even a way to create a from scratch GenericValue that would define/encapsulate an IssueLink would be helpful.

Thank you :)

1 answer

1 accepted

Have you considered creating actual mock objects? Mockito, jMock, and Easymock all make this pretty easy.

IssueLink issueLink = Mockito.mock(IssueLink.class);


You can then pass the issueLink object around for your tests. For details about Mockito (my preferred mock library) see:

lets just say there is more red tape than usual around this specific project. Downloading FOSS tools, I.E. Mockito, is not permitted.

As I'm sure you are aware, the IssueLink type is NOT an interface. My end scenario has to involve using only JUnit and JIRA 4.4 API.

Basically, I'm looking for an easy way to Unit Test Issue Link lookups without having to write some strange/convoluted hack to get around the existing infrastructure.

if Jira 4.4 API is not capable of this in a simple fashioned, a solid explanation of WHY would get you an answer awarded, preferably by someone with a respectable karma tally.

Yeah, I can't speak definitively about the Jira 4.4 API, hopefully someone else can. Sorry to hear about the red tape, I really hate that =( For what it's worth, the Atlassian Plugin SDK comes with Mockito built in I think (at least, it isn't listed in my POM anywhere, it "just works") so you might already have it just the same.

If nobody answers in a few days, I'd really appreciate you accepting my answer, since it is a valid answer to the question (and not relevant to most people that you can't use third party libraries which are actually bundled with the atlassian plugin SDK)

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

46 views 1 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot