public class

MockIssue

extends Object
implements MutableIssue
java.lang.Object
   ↳ com.atlassian.jira.mock.issue.MockIssue

Class Overview

Copyright (c) 2002-2006 All rights reserved.

Summary

[Expand]
Inherited Fields
From interface com.atlassian.jira.entity.WithId
From interface com.atlassian.jira.issue.context.IssueContext
Public Constructors
MockIssue()
MockIssue(Long id)
This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.
MockIssue(long id)
This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.
MockIssue(int id, String key)
This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.
MockIssue(Long id, Long now)
Use this constructor if you want time precision in your tests
MockIssue(GenericValue gv)
Use this constructor if you have a gv
Public Methods
boolean equals(Object o)
Collection getAffectedVersions()
ApplicationUser getAssignee()
Returns the Assignee User.
String getAssigneeId()
ApplicationUser getAssigneeUser()
Returns the Assignee User.
Collection getAttachments()
Collection<ProjectComponent> getComponentObjects()
This method is deprecated. Use getComponents(). Since v7.0
Collection<ProjectComponent> getComponents()
Timestamp getCreated()
ApplicationUser getCreator()
String getCreatorId()
Object getCustomFieldValue(CustomField customField)
String getDescription()
Timestamp getDueDate()
String getEnvironment()
Long getEstimate()
This is the "remaining estimate" of work left to be performed on this issue, in milliseconds.
Object getExternalFieldValue(String fieldId)
Collection getFixVersions()
GenericValue getGenericValue()
Get the backing GenericValue object.
Long getId()
IssueRenderContext getIssueRenderContext()
IssueType getIssueType()
Gets the IssueType for this Issue.
String getIssueTypeId()
Gets the ID of the IssueType for this Issue.
IssueType getIssueTypeObject()
Gets the IssueType for this Issue.
String getKey()
Set<Label> getLabels()
Returns a set of all the labels for this issue or an empty set if none exist yet.
Long getLong(String name)
Retrieve a numeric field.
Map<StringModifiedValue> getModifiedFields()
Retrieve a map of issue fields whose values have been set (since object creation or last resetModifiedFields() call.
Long getNumber()
Long getOriginalEstimate()
This is the "original estimate" of work to be performed on this issue, in milliseconds.
GenericValue getParent()
Long getParentId()
Issue getParentObject()
If this issue is a subtask, return its parent.
Priority getPriority()
Returns the Priority for this Issue.
String getPriorityId()
Priority getPriorityObject()
Returns the Priority for this Issue.
GenericValue getProject()
Long getProjectId()
Gets the ID of the Project for this Issue.
Project getProjectObject()
Gets the Project for this Issue.
ApplicationUser getReporter()
Returns the Reporter User.
String getReporterId()
ApplicationUser getReporterUser()
Returns the Reporter User.
Resolution getResolution()
Returns the Resolution for this Issue.
Timestamp getResolutionDate()
Returns the datetime that an issue was resolved on.
String getResolutionId()
Resolution getResolutionObject()
Returns the Resolution for this Issue.
GenericValue getSecurityLevel()
Returns the Security Level for this Issue.
Long getSecurityLevelId()
Returns the Security Level for this Issue.
Status getStatus()
String getStatusId()
Status getStatusObject()
String getString(String name)
Retrieve a String field.
Collection getSubTaskObjects()
Gets all the issue's subtasks.
Collection getSubTasks()
String getSummary()
Long getTimeSpent()
This is the "total time spent" working on this issue, in milliseconds.
Timestamp getTimestamp(String name)
Retrieve a timestamp field.
Timestamp getUpdated()
Long getVotes()
Long getWatches()
Long getWorkflowId()
boolean isCreated()
boolean isEditable()
boolean isStored()
boolean isSubTask()
void resetModifiedFields()
Reset the internal list of modified fields.
void setAffectedVersions(Collection affectedVersions)
void setAssignee(ApplicationUser assignee)
void setAssigneeId(String assigneeId)
Sets the user that this issue is assigned to.
void setComponent(Collection<ProjectComponent> components)
Sets the components for this Issue.
void setCreated(Timestamp created)
void setCreatorId(String creatorId)
void setCustomFieldValue(CustomField customField, Object value)
Sets a custom field value on this Issue Object, but does not write it to the database.
void setDescription(String description)
void setDueDate(Timestamp dueDate)
void setEnvironment(String environment)
void setEstimate(Long estimate)
void setExternalFieldValue(String fieldId, Object oldValue, Object newValue)
This can be used bya field to "place" a custom object into the MutableIssue so that it can be retrieved by key at a later point via the getModifiedFields() and getExternalFieldValue(String).
void setExternalFieldValue(String fieldId, Object value)
This can be used by a field to "place" a custom object into the MutableIssue so that it can be retrieved by key at a later point via the getModifiedFields() and getExternalFieldValue(String).
void setFixVersions(Collection fixVersions)
void setGenericValue(GenericValue genericValue)
void setId(Long id)
void setIssueType(IssueType issueType)
void setIssueType(GenericValue issueType)
void setIssueTypeId(String issueTypeId)
void setIssueTypeObject(IssueType issueTypeObject)
Sets the IssueType for this Issue.
void setKey(String key)
void setLabels(Set<Label> labels)
Set the labels for this issue.
void setModifiedFields(Map modifiedFields)
void setNumber(Long number)
void setOriginalEstimate(Long originalEstimate)
void setParentId(Long parentId)
Sets the ParentId of this Issue.
void setParentObject(Issue parentIssue)
Sets the parent Issue Object for this Issue (subtask).
void setPriority(Priority priority)
Sets the priority for this Issue.
void setPriorityId(String priorityId)
Sets the priority for this Issue.
void setPriorityObject(Priority priority)
Sets the priority for this Issue.
void setProject(GenericValue project)
Sets the Project for this Issue.
void setProjectId(Long projectId)
Sets the project by id.
void setProjectObject(Project projectObject)
Sets the Project for this Issue.
void setReporter(ApplicationUser reporter)
void setReporterId(String reporterId)
Sets the reporter in this issue.
void setResolution(GenericValue resolution)
void setResolution(Resolution resolution)
Sets the resolution for this Issue.
void setResolutionDate(Timestamp resolutionDate)
void setResolutionId(String resolutionId)
void setResolutionObject(Resolution resolutionObject)
Sets the resolution for this Issue.
void setSecurityLevel(GenericValue securityLevel)
Sets the SecurityLevel for this Issue.
void setSecurityLevelId(Long securityLevelId)
Sets the SecurityLevel for this Issue.
void setStatus(Status status)
Sets the status for this Issue.
void setStatus(GenericValue status)
void setStatusId(String statusId)
Set issue's status by status id ("1", "2" etc).
void setStatusObject(Status status)
Sets the status for this Issue.
void setSubTaskObjects(Collection subTaskObjects)
void setSummary(String summary)
void setTimeSpent(Long timespent)
void setUpdated(Timestamp updated)
void setVotes(Long votes)
void setWatches(Long watches)
void setWorkflowId(Long workflowId)
void store()
Persist this issue's immediate fields.
String toString()
Protected Methods
GenericValue getHackedGVThatReturnsId()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.entity.WithId
From interface com.atlassian.jira.entity.WithKey
From interface com.atlassian.jira.issue.Issue
From interface com.atlassian.jira.issue.MutableIssue
From interface com.atlassian.jira.issue.context.IssueContext
From interface com.atlassian.jira.ofbiz.OfBizValueWrapper

Public Constructors

public MockIssue ()

public MockIssue (Long id)

This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.

public MockIssue (long id)

This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.

public MockIssue (int id, String key)

This constructor does not have any time precision set by default use MockIssue(Long id, Long now) if you want to preset the Issue's time values.

public MockIssue (Long id, Long now)

Use this constructor if you want time precision in your tests

public MockIssue (GenericValue gv)

Use this constructor if you have a gv

Public Methods

public boolean equals (Object o)

public Collection getAffectedVersions ()

public ApplicationUser getAssignee ()

Returns the Assignee User.

Warning: previous incarnations of this method returned com.opensymphony.user.User. This class has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with earlier versions.

Returns
  • the Assignee User.

public String getAssigneeId ()

public ApplicationUser getAssigneeUser ()

Returns the Assignee User.

If there is no assignee it returns null, else it is guaranteed to return a non-null User. If the User is no longer available, it will create a dummy User object based on the username.

Legacy synonym for getAssignee()

Returns
  • the Assignee User.

public Collection getAttachments ()

public Collection<ProjectComponent> getComponentObjects ()

This method is deprecated.
Use getComponents(). Since v7.0

@return

public Collection<ProjectComponent> getComponents ()

public Timestamp getCreated ()

public ApplicationUser getCreator ()

public String getCreatorId ()

public Object getCustomFieldValue (CustomField customField)

public String getDescription ()

public Timestamp getDueDate ()

public String getEnvironment ()

public Long getEstimate ()

This is the "remaining estimate" of work left to be performed on this issue, in milliseconds.

A better name would be getRemainingEstimate but for historical reasons it is called what it is called.

Returns
  • the "remaining estimate" of work left to be performed on this issue, in milliseconds.

public Object getExternalFieldValue (String fieldId)

public Collection getFixVersions ()

public GenericValue getGenericValue ()

Get the backing GenericValue object.

Returns
  • the backing GenericValue object.

public Long getId ()

public IssueRenderContext getIssueRenderContext ()

public IssueType getIssueType ()

Gets the IssueType for this Issue.

Returns
  • The IssueType for this Issue.

public String getIssueTypeId ()

Gets the ID of the IssueType for this Issue.

Returns
  • The ID of the IssueType for this Issue.

public IssueType getIssueTypeObject ()

Gets the IssueType for this Issue.

Returns
  • The IssueType for this Issue.

public String getKey ()

public Set<Label> getLabels ()

Returns a set of all the labels for this issue or an empty set if none exist yet.

Returns
  • a set of all the labels for this issue or an empty set if none exist yet

public Long getLong (String name)

Retrieve a numeric field.

Parameters
name the field name
Returns
  • the value for the given field.

public Map<StringModifiedValue> getModifiedFields ()

Retrieve a map of issue fields whose values have been set (since object creation or last resetModifiedFields() call.

Returns
  • A Map of key -> ModifiedValue pairs, where keys are defined in IssueFieldConstants and the value objects in the ModifiedValue are field-specific.

public Long getNumber ()

public Long getOriginalEstimate ()

This is the "original estimate" of work to be performed on this issue, in milliseconds.

Returns
  • the "original estimate" of work to be performed on this issue, in milliseconds.

public GenericValue getParent ()

public Long getParentId ()

public Issue getParentObject ()

If this issue is a subtask, return its parent.

Returns
  • The parent Issue, or null if the issue is not a subtask.

public Priority getPriority ()

Returns the Priority for this Issue.

Returns
  • the Priority for this Issue.

public String getPriorityId ()

public Priority getPriorityObject ()

Returns the Priority for this Issue.

Returns
  • the Priority for this Issue.

public GenericValue getProject ()

public Long getProjectId ()

Gets the ID of the Project for this Issue.

Returns
  • The ID of the Project for this Issue.

public Project getProjectObject ()

Gets the Project for this Issue.

Returns
  • The Project for this Issue.

public ApplicationUser getReporter ()

Returns the Reporter User.

Warning: previous incarnations of this method returned com.opensymphony.user.User. This class has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with earlier versions.

Returns
  • the Reporter User.

public String getReporterId ()

public ApplicationUser getReporterUser ()

Returns the Reporter User.

This will return a non-null User object even if the User has been deleted.

Legacy synonym for getReporter().

Returns
  • the Reporter User.

public Resolution getResolution ()

Returns the Resolution for this Issue.

Returns
  • the Resolution for this Issue.

public Timestamp getResolutionDate ()

Returns the datetime that an issue was resolved on. Will be null if it hasn't been resolved yet, or if an issue has been returned to the 'unresolved' state.

Returns
  • Timestamp of when an issue was resolved, or null

public String getResolutionId ()

public Resolution getResolutionObject ()

Returns the Resolution for this Issue.

Returns
  • the Resolution for this Issue.

public GenericValue getSecurityLevel ()

Returns the Security Level for this Issue.

Returns
  • the Security Level for this Issue.

public Long getSecurityLevelId ()

Returns the Security Level for this Issue.

Returns
  • the Security Level for this Issue.

public Status getStatus ()

public String getStatusId ()

public Status getStatusObject ()

public String getString (String name)

Retrieve a String field.

Parameters
name the field name
Returns
  • the value for the given field.

public Collection getSubTaskObjects ()

Gets all the issue's subtasks.

Returns

public Collection getSubTasks ()

public String getSummary ()

public Long getTimeSpent ()

This is the "total time spent" working on this issue, in milliseconds.

Returns
  • the "total time spent" working on this issue, in milliseconds.

public Timestamp getTimestamp (String name)

Retrieve a timestamp field.

Parameters
name the field name
Returns
  • the value for the given field.

public Timestamp getUpdated ()

public Long getVotes ()

public Long getWatches ()

public Long getWorkflowId ()

public boolean isCreated ()

public boolean isEditable ()

public boolean isStored ()

public boolean isSubTask ()

public void resetModifiedFields ()

Reset the internal list of modified fields.

public void setAffectedVersions (Collection affectedVersions)

public void setAssignee (ApplicationUser assignee)

public void setAssigneeId (String assigneeId)

Sets the user that this issue is assigned to. Note that this should be the userkey, not the username.

Parameters
assigneeId The user key.

public void setComponent (Collection<ProjectComponent> components)

Sets the components for this Issue.

Parameters
components the new components value

public void setCreated (Timestamp created)

public void setCreatorId (String creatorId)

public void setCustomFieldValue (CustomField customField, Object value)

Sets a custom field value on this Issue Object, but does not write it to the database. This is highly misleading.
To actually set a custom field value, use updateIssue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, MutableIssue, java.util.Map)

Parameters
customField the CustomField
value the value.

public void setDescription (String description)

public void setDueDate (Timestamp dueDate)

public void setEnvironment (String environment)

public void setEstimate (Long estimate)

public void setExternalFieldValue (String fieldId, Object oldValue, Object newValue)

This can be used bya field to "place" a custom object into the MutableIssue so that it can be retrieved by key at a later point via the getModifiedFields() and getExternalFieldValue(String).

The passed in newValue will be wrapped in the getNewValue() and the oldValue will be placed in getOldValue()

Parameters
fieldId the field id to use as a key
oldValue the old value to place in a ModifiedValue
newValue the new value to place in a ModifiedValue

public void setExternalFieldValue (String fieldId, Object value)

This can be used by a field to "place" a custom object into the MutableIssue so that it can be retrieved by key at a later point via the getModifiedFields() and getExternalFieldValue(String).

The passed in newValue will be wrapped in the getNewValue() The getOldValue() will be null.

Parameters
fieldId the field id to use as a key
value the new value to place in a ModifiedValue

public void setFixVersions (Collection fixVersions)

public void setGenericValue (GenericValue genericValue)

public void setId (Long id)

public void setIssueType (IssueType issueType)

public void setIssueType (GenericValue issueType)

public void setIssueTypeId (String issueTypeId)

public void setIssueTypeObject (IssueType issueTypeObject)

Sets the IssueType for this Issue.

Parameters
issueTypeObject the new IssueType

public void setKey (String key)

public void setLabels (Set<Label> labels)

Set the labels for this issue.

Parameters
labels the labels for this issue

public void setModifiedFields (Map modifiedFields)

public void setNumber (Long number)

public void setOriginalEstimate (Long originalEstimate)

public void setParentId (Long parentId)

Sets the ParentId of this Issue.

Parameters
parentId The new parentId.

public void setParentObject (Issue parentIssue)

Sets the parent Issue Object for this Issue (subtask).

Normally a subtask just has the ID of the parent set using setParentId(). In this case, the getParentObject() method will look up the parent object from the DB (or cache). However, when you are editing a parent and its subtask within a transaction (eg a Bulk Move), it is useful to be able to link the subtask to the pending parent object in order that it can see the new values for the parent.

Parameters
parentIssue the required parent Issue for this subtask.

public void setPriority (Priority priority)

Sets the priority for this Issue.

Parameters
priority the new priority value

public void setPriorityId (String priorityId)

Sets the priority for this Issue.

Parameters
priorityId the new priority value

public void setPriorityObject (Priority priority)

Sets the priority for this Issue.

Parameters
priority the new priority value

public void setProject (GenericValue project)

Sets the Project for this Issue.

Parameters
project the new Project

public void setProjectId (Long projectId)

Sets the project by id.

Parameters
projectId The id of the project

public void setProjectObject (Project projectObject)

Sets the Project for this Issue.

Parameters
projectObject the new Project

public void setReporter (ApplicationUser reporter)

public void setReporterId (String reporterId)

Sets the reporter in this issue. Note that this should be the userkey, not the username.

Parameters
reporterId userkey of the desired reporter.

public void setResolution (GenericValue resolution)

public void setResolution (Resolution resolution)

Sets the resolution for this Issue.

public void setResolutionDate (Timestamp resolutionDate)

public void setResolutionId (String resolutionId)

public void setResolutionObject (Resolution resolutionObject)

Sets the resolution for this Issue.

Parameters
resolutionObject the new resolution value

public void setSecurityLevel (GenericValue securityLevel)

Sets the SecurityLevel for this Issue.

Parameters
securityLevel the new SecurityLevel value

public void setSecurityLevelId (Long securityLevelId)

Sets the SecurityLevel for this Issue.

Parameters
securityLevelId the new SecurityLevel value

public void setStatus (Status status)

Sets the status for this Issue.

Parameters
status the new status value

public void setStatus (GenericValue status)

public void setStatusId (String statusId)

Set issue's status by status id ("1", "2" etc).

Parameters
statusId the new StatusId.

public void setStatusObject (Status status)

Sets the status for this Issue.

Parameters
status the new status value

public void setSubTaskObjects (Collection subTaskObjects)

public void setSummary (String summary)

public void setTimeSpent (Long timespent)

public void setUpdated (Timestamp updated)

public void setVotes (Long votes)

public void setWatches (Long watches)

public void setWorkflowId (Long workflowId)

public void store ()

Persist this issue's immediate fields. This is for internal usage only.

public String toString ()

Protected Methods

protected GenericValue getHackedGVThatReturnsId ()