Perform HTTP GET and POST Requests MockMvc to Test a @RestController

Поделиться
HTML-код
  • Опубликовано: 29 янв 2025

Комментарии • 16

  • @simi2430
    @simi2430 4 года назад +1

    Great videos, thanks for sharing and request you to keep posting such high quality materials.

    • @rieckpil
      @rieckpil  4 года назад

      thanks a lot for your feedback :)

    • @ClassicAs_03
      @ClassicAs_03 Год назад

      I have been looking for how to test controller thanks 🙏 a lot this really means a lot I will be looking forward to seeing this type of content

  • @DelaDachnie
    @DelaDachnie 2 года назад +1

    thanks you ! awesome material

  • @rafaelnunes1150
    @rafaelnunes1150 4 года назад

    Thank you so much for this! Great video

  • @АлександрБугримов-о1е

    thank you very much for the video

  • @fernandoambrosio1200
    @fernandoambrosio1200 4 года назад

    Great video, for a report with Spring boot you would also have to do tests ?

    • @rieckpil
      @rieckpil  4 года назад

      what do you exactly mean with "a report"?

    • @fernandoambrosio1200
      @fernandoambrosio1200 4 года назад

      @@rieckpil If to generate an report in pdf and excel, I need to to perform tests. Excuse me for my english, I speak spanish.

    • @rieckpil
      @rieckpil  4 года назад +2

      @@fernandoambrosio1200 as such Spring MVC endpoints usually return byte[] you have to define what you want to actually test. It still makes sense to write an integration test and let your application generate a PDF or Excel. Afterward, you can e.g. use a PDF library to ensure important parts are present inside the document, e.g. customer number, dates, etc.

    • @fernandoambrosio1200
      @fernandoambrosio1200 4 года назад

      @@rieckpil Thanks so much.

  • @juanignacioolguin7610
    @juanignacioolguin7610 3 года назад

    Great video! Do you know why my controller unit test is skipping the Mockito when(service.method()).thenReturn(value) method? It looks like the test just ignores it, thank you!

    • @rieckpil
      @rieckpil  3 года назад

      Without seeing your test it's hard to tell :D
      Can you post a question on Stack Overflow, include your controller and test setup and send me the link?

  • @АлександрБерестов-р1э

    what a "Location"? where is it?

    • @rieckpil
      @rieckpil  2 года назад

      HTTP Location header of the response