Class TicketsWebServiceScratchpadRoutingTest

java.lang.Object
org.glassfish.jersey.test.JerseyTest
ubic.gemma.rest.TicketsWebServiceScratchpadRoutingTest

public class TicketsWebServiceScratchpadRoutingTest extends org.glassfish.jersey.test.JerseyTest
Real JAX-RS path matching for GET /tickets/scratchpad โ€” the one thing the mocked TicketsWebServiceTest cannot see, since it calls the handler methods directly and a literal route swallowed by @Path("/{id}") would still pass there.

JAX-RS sorts candidate methods by literal character count ahead of template count (JSR-370 ยง3.7.2), so /scratchpad outranks /{id}. If that stopped holding, the request would reach TicketsWebService.getTicket(Long) with "scratchpad" to convert to a Long and Jersey would answer 404 โ€” hence the 200 assertion, paired with a numeric id that must still reach /{id} so the first assertion means the literal segment won a real contest.

Deliberately NOT a BaseJerseyIntegrationTest5: no database and no application context are needed, only the in-memory container and a mocked service, so this stays in the fast suite. Spring method security is absent, so @PreAuthorize does not fire here โ€” the auth contract is asserted by reflection in TicketsWebServiceTest instead.

  • Constructor Details

    • TicketsWebServiceScratchpadRoutingTest

      public TicketsWebServiceScratchpadRoutingTest()
  • Method Details

    • getTestContainerFactory

      protected org.glassfish.jersey.test.spi.TestContainerFactory getTestContainerFactory()
      Overrides:
      getTestContainerFactory in class org.glassfish.jersey.test.JerseyTest
    • configure

      protected jakarta.ws.rs.core.Application configure()
      Overrides:
      configure in class org.glassfish.jersey.test.JerseyTest
    • setUp

      @BeforeEach public void setUp() throws Exception
      Overrides:
      setUp in class org.glassfish.jersey.test.JerseyTest
      Throws:
      Exception
    • tearDown

      @AfterEach public void tearDown() throws Exception
      Overrides:
      tearDown in class org.glassfish.jersey.test.JerseyTest
      Throws:
      Exception
    • scratchpadRoute_isNotSwallowedByTheIdTemplate

      @Test public void scratchpadRoute_isNotSwallowedByTheIdTemplate()
    • numericIdStillRoutesToTheSingleTicketHandler

      @Test public void numericIdStillRoutesToTheSingleTicketHandler()
      The numeric-id route is still live, so the 200 above is a contest won, not a template gone.