Class MockSearchContext

java.lang.Object
com.atlassian.jira.mock.issue.search.MockSearchContext
All Implemented Interfaces:
SearchContext

public class MockSearchContext extends Object implements SearchContext
Simple search context for testing. Most methods don't actually work.
Since:
v4.0
  • Constructor Details

    • MockSearchContext

      public MockSearchContext()
    • MockSearchContext

      public MockSearchContext(Project... projects)
  • 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 interface SearchContext
      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 interface SearchContext
      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 interface SearchContext
      Returns:
      true if there is exactly one Project in this SearchContext.
    • getSingleProject

      public Project 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 interface SearchContext
      Returns:
      the single Project for this SearchContext.
      See Also:
    • getProjectCategoryIds

      public List getProjectCategoryIds()
      Description copied from interface: SearchContext
      Returns selected category IDs.
      Specified by:
      getProjectCategoryIds in interface SearchContext
      Returns:
      Empty list if no categories were selected
    • getProjectIds

      public List<Long> getProjectIds()
      Description copied from interface: SearchContext
      Project ids as Longs.
      Specified by:
      getProjectIds in interface SearchContext
      Returns:
      List of Long objects, possibly empty.
    • getOnlyProject

      public org.ofbiz.core.entity.GenericValue getOnlyProject()
    • getIssueTypeIds

      public List<String> getIssueTypeIds()
      Description copied from interface: SearchContext
      Issue ids as Strings
      Specified by:
      getIssueTypeIds in interface SearchContext
      Returns:
      List of issue type ids possibly empty.
    • getAsIssueContexts

      public List<IssueContext> getAsIssueContexts()
      Description copied from interface: SearchContext
      Gets the search context as a list of IssueContext objects
      Specified by:
      getAsIssueContexts in interface SearchContext
      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 interface SearchContext
    • getProjects

      @Nonnull public List<Project> getProjects()
      Description copied from interface: SearchContext
      Returns project objects in this SearchContext
      Specified by:
      getProjects in interface SearchContext
      Returns:
      List of Project. If no projects are selected, returns an empty list.
    • getIssueTypes

      @Nonnull public List<IssueType> getIssueTypes()
      Description copied from interface: SearchContext
      Returns issue types objects in this SearchContext
      Specified by:
      getIssueTypes in interface SearchContext
      Returns:
      List of IssueType. If no issue types are selected, returns an empty list