java.lang.AssertionError: Status Expected :200 Actual :500

0

testuję w mockMVC tą metodę get

moja metoda testowa jest


Mam naste[ujacy błąd:

MockHttpServletRequest:
      HTTP Method = GET
      Request URI = /users/1
       Parameters = {}
          Headers = {}
             Body = <no character encoding set>
    Session Attrs = {}
Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = org.springframework.web.method.annotation.MethodArgumentTypeMismatchException

ModelAndView:
        View name = null
             View = null
            Model = null
FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 500
    Error message = null
          Headers = {Content-Type=[text/plain;charset=ISO-8859-1], Content-Length=[14]}
     Content type = text/plain;charset=ISO-8859-1
             Body = We are doomed.
    Forwarded URL = null
   Redirected URL = null
          Cookies = []



i written a test in spring mockMVC this method:

  @GetMapping(value = "/{id}")
    @ApiOperation(value = "Retrieve account.")
    public @ResponseBody ResponseEntity<AccountDTO> getAccount(@PathVariable UUID id) {
        return accountService.retreiveById(id).map(ResponseEntity::ok)
                .orElseGet(() -> ResponseEntity.notFound().build());
    }
my method testing is:


and i have a following bug:

MockHttpServletRequest:
      HTTP Method = GET
      Request URI = /users/1
       Parameters = {}
          Headers = {}
             Body = <no character encoding set>
    Session Attrs = {}
Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = org.springframework.web.method.annotation.MethodArgumentTypeMismatchException

ModelAndView:
        View name = null
             View = null
            Model = null
FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 500
    Error message = null
          Headers = {Content-Type=[text/plain;charset=ISO-8859-1], Content-Length=[14]}
     Content type = text/plain;charset=ISO-8859-1
             Body = We are doomed.
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
java.lang.AssertionError: Status Expected :200 Actual :500 this is my POST method test

co jest nie tak z moim testem? jak to naprawić?
0

No a jak przekonwertować liczbę 1 (/account/1) na UUID (@PathVariable UUID id)? Ja też nie potrafię.

1 użytkowników online, w tym zalogowanych: 0, gości: 1