### Question:
SagaTransactionsController { @GetMapping(value = "/findTransactions") public ResponseEntity<Collection<SagaTransactionsController.TxEventVo>> findTransactions( @RequestParam(required = false, name = "globalTxID") Object globalTxID, @RequestParam(required = false, name = "microServiceName") String microServiceName) { Iterable<TxEvent> events; if (globalTxID != null) { events = eventRepository.findByGlobalTxId(globalTxID.toString()); } else if (!"".equals(microServiceName)) { events = eventRepository.findByServiceName(microServiceName); } else { events = null; } Collection<TxEventVo> eventVos = new LinkedList<>(); if (events != null) { events.forEach(event -> eventVos.add(new SagaTransactionsController.TxEventVo(event))); } return ResponseEntity.ok(eventVos); } SagaTransactionsController(TxEventEnvelopeRepository eventRepository); @GetMapping(value = "/stats") ResponseEntity<Stats> getStats(); @GetMapping(value = "/recent") ResponseEntity<Collection<SagaTransactionsController.TxEventVo>> recentTransactions(
      @RequestParam(name = "status") String status, @RequestParam(name = "count") int count); @GetMapping(value = "/transactions") ResponseEntity<Collection<SagaTransactionsController.TxEventVo>> getTransactions(
      @RequestParam(name = "status") String status); @GetMapping(value = "/findTransactions") ResponseEntity<Collection<SagaTransactionsController.TxEventVo>> findTransactions(
      @RequestParam(required = false, name = "globalTxID") Object globalTxID,
      @RequestParam(required = false, name = "microServiceName") String microServiceName);  }### Answer:
@Test public void findTransactionsTest() throws Exception { mockMvc.perform(get("/saga/findTransactions?globalTxID=XXXGID")) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(4))); mockMvc.perform(get("/saga/findTransactions?microServiceName=XXService")) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(1))); mockMvc.perform(get("/saga/findTransactions")) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(0))); }