Class TicketSearchQueryTest

java.lang.Object
ubic.gemma.persistence.service.common.auditAndSecurity.curation.TicketSearchQueryTest

public class TicketSearchQueryTest extends Object
Query construction behind GET /tickets/search: the HQL TicketDaoImpl.buildSearchHitHql(boolean, boolean, boolean) emits, the LIKE pattern TicketDaoImpl.searchLikePattern(String) builds, and the row projection TicketSearchHitValueObject.fromRow(Object[]).

These assert on the generated HQL rather than on rows from a database, which pins the shape of the query — notably that targetCount is a count() the database evaluates and that the targets collection is never named — without needing gemdtest. It does NOT prove the HQL executes; TicketPersistenceIT.search* does that against a real schema.

Author:
paul
  • Constructor Details

    • TicketSearchQueryTest

      public TicketSearchQueryTest()
  • Method Details

    • titleQuery_matchesACaseInsensitiveSubstringOfTheTitle

      @Test public void titleQuery_matchesACaseInsensitiveSubstringOfTheTitle()
    • idQuery_matchesTheIdColumnVerbatim

      @Test public void idQuery_matchesTheIdColumnVerbatim()
    • targetCountIsCountedBySql_andTheTargetsCollectionIsNeverNamed

      @Test public void targetCountIsCountedBySql_andTheTargetsCollectionIsNeverNamed()
      The reason this endpoint exists rather than GET /tickets?query=: a picker showing 20 hits must not fetch 500 target rows for one of them.
    • openOnly_restrictsToTheOpenStates

      @Test public void openOnly_restrictsToTheOpenStates()
    • openOnlyFalse_leavesTheStatePredicateOut

      @Test public void openOnlyFalse_leavesTheStatePredicateOut()
    • scratchpads_areExcludedOutrightWhenTheCallerIsUnknown

      @Test public void scratchpads_areExcludedOutrightWhenTheCallerIsUnknown()
      Another curator's scratchpad is not somewhere to file work, so it is not offered; when nobody is identified, no scratchpad is.
    • scratchpads_areOfferedToTheCuratorWhoReportedThem

      @Test public void scratchpads_areOfferedToTheCuratorWhoReportedThem()
    • titleQuery_ordersByUpdatedAtDescending

      @Test public void titleQuery_ordersByUpdatedAtDescending()
    • idQuery_hasNoOrderBy

      @Test public void idQuery_hasNoOrderBy()
      The id lookup returns at most one row, and the service puts it first. An ORDER BY here would be noise, and one that tried to interleave the two halves would put a stale exact match behind fresher title matches.
    • likePattern_isASubstringMatchAgainstLowercasedText

      @Test public void likePattern_isASubstringMatchAgainstLowercasedText()
    • likePattern_escapesTheCallersOwnWildcards

      @Test public void likePattern_escapesTheCallersOwnWildcards()
      A curator's own wildcards are data, not syntax: 50% looks for a title containing "50%", and TNF_alpha does not match "TNFXalpha".
    • fromRow_projectsTheColumnsInTheOrderTheQuerySelectsThem

      @Test public void fromRow_projectsTheColumnsInTheOrderTheQuerySelectsThem()
    • fromRow_readsAZeroTargetTicketAsZeroNotNull

      @Test public void fromRow_readsAZeroTargetTicketAsZeroNotNull()