@Test public void testCreateCrn() throws Exception { when(crnGeneratorService.generate("default")).thenReturn("crn_value"); mockMvc.perform( post("/crn/v1/_create") .param("tenantId","default") ) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(content().json("{\"value\": \"crn_value\"}")); }
@PostMapping("/v1/_create") public ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId") final String tenantId) { return new ComplaintRegistrationNumber(crnGeneratorService.generate(tenantId)); }
CrnController { @PostMapping("/v1/_create") public ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId") final String tenantId) { return new ComplaintRegistrationNumber(crnGeneratorService.generate(tenantId)); } }
CrnController { @PostMapping("/v1/_create") public ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId") final String tenantId) { return new ComplaintRegistrationNumber(crnGeneratorService.generate(tenantId)); } CrnController(CrnGeneratorService crnGeneratorService); }
CrnController { @PostMapping("/v1/_create") public ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId") final String tenantId) { return new ComplaintRegistrationNumber(crnGeneratorService.generate(tenantId)); } CrnController(CrnGeneratorService crnGeneratorService); @GetMapping() ComplaintRegistrationNumber getCrn(@RequestParam(value = "tenantId") final String tenantId); @PostMapping("/v1/_create") ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId")  final String tenantId); }
CrnController { @PostMapping("/v1/_create") public ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId") final String tenantId) { return new ComplaintRegistrationNumber(crnGeneratorService.generate(tenantId)); } CrnController(CrnGeneratorService crnGeneratorService); @GetMapping() ComplaintRegistrationNumber getCrn(@RequestParam(value = "tenantId") final String tenantId); @PostMapping("/v1/_create") ComplaintRegistrationNumber createCrn(@RequestParam(value = "tenantId")  final String tenantId);  }