Class MockSearchContext
java.lang.Object
com.atlassian.jira.mock.issue.search.MockSearchContext
- All Implemented Interfaces:
SearchContext
Simple search context for testing. Most methods don't actually work.
- Since:
- v4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the search context as a list ofIssueContext
objectsIssue ids as StringsReturns issue types objects in this SearchContextorg.ofbiz.core.entity.GenericValue
Returns selected category IDs.Project ids as Longs.Returns project objects in this SearchContextReturns the single Project for this SearchContext.boolean
Returns true if no specific issue types have been selectedboolean
Returns whether the context is global or not.boolean
Returns true if there is exactly one Project in this SearchContext.void
verify()
Verifies that all issue types and projects in the context actually still exists.
-
Constructor Details
-
MockSearchContext
public MockSearchContext() -
MockSearchContext
-
-
Method Details
-
isForAnyProjects
public boolean isForAnyProjects()Description copied from interface:SearchContext
Returns whether the context is global or not. A context is global when there are no project restrictions and no project category restrictions.- Specified by:
isForAnyProjects
in interfaceSearchContext
- Returns:
- boolean
-
isForAnyIssueTypes
public boolean isForAnyIssueTypes()Description copied from interface:SearchContext
Returns true if no specific issue types have been selected- Specified by:
isForAnyIssueTypes
in interfaceSearchContext
- Returns:
- boolean
-
isSingleProjectContext
public boolean isSingleProjectContext()Description copied from interface:SearchContext
Returns true if there is exactly one Project in this SearchContext.- Specified by:
isSingleProjectContext
in interfaceSearchContext
- Returns:
- true if there is exactly one Project in this SearchContext.
-
getSingleProject
Description copied from interface:SearchContext
Returns the single Project for this SearchContext.You should first call
SearchContext.isSingleProjectContext()
to check if this is valid.- Specified by:
getSingleProject
in interfaceSearchContext
- Returns:
- the single Project for this SearchContext.
- See Also:
-
getProjectCategoryIds
Description copied from interface:SearchContext
Returns selected category IDs.- Specified by:
getProjectCategoryIds
in interfaceSearchContext
- Returns:
- Empty list if no categories were selected
-
getProjectIds
Description copied from interface:SearchContext
Project ids as Longs.- Specified by:
getProjectIds
in interfaceSearchContext
- Returns:
- List of Long objects, possibly empty.
-
getOnlyProject
public org.ofbiz.core.entity.GenericValue getOnlyProject() -
getIssueTypeIds
Description copied from interface:SearchContext
Issue ids as Strings- Specified by:
getIssueTypeIds
in interfaceSearchContext
- Returns:
- List of issue type ids possibly empty.
-
getAsIssueContexts
Description copied from interface:SearchContext
Gets the search context as a list ofIssueContext
objects- Specified by:
getAsIssueContexts
in interfaceSearchContext
- Returns:
- List of
IssueContext
. If no issue types or projects selected. A blank issue context is returned. Never null.
-
verify
public void verify()Description copied from interface:SearchContext
Verifies that all issue types and projects in the context actually still exists. This might not be the case. Also removes any projects or issue types from this SearchContext that do not (any longer) exist in the backing store.- Specified by:
verify
in interfaceSearchContext
-
getProjects
Description copied from interface:SearchContext
Returns project objects in this SearchContext- Specified by:
getProjects
in interfaceSearchContext
- Returns:
- List of
Project
. If no projects are selected, returns an empty list.
-
getIssueTypes
Description copied from interface:SearchContext
Returns issue types objects in this SearchContext- Specified by:
getIssueTypes
in interfaceSearchContext
- Returns:
- List of
IssueType
. If no issue types are selected, returns an empty list
-