I want to write a tesa for the websocket controller, but no example from the network calls me the methods from the controller. Who already has experience writing such tests, please set an example.

Controller:

@Controller public class SectionContoller { @Autowired private ISectionService sectionService; @MessageMapping("/section/add") @SendToUser public Message addSection(EntitySection section){ sectionService.addSection(section); return MessageBuilder .withPayload("") .setHeader(HEADER_STATUS,STATUS_OK) .build(); } } 

UPDATE 1
I tried to connect to the websocket server using this method, but in the logs the connection was not displayed, did the MB have any subtlety of using the Websocket spring client?

  • one
    What exactly do you want to test? describe the test in words. - Mikhail Vaysman
  • The @Mikhail Vaysman method addSection should addSection and return a message. I just can not understand how to test controllers for websocket. - Bleser
  • it's just a method. call it in the test and check the result. - Mikhail Vaysman
  • @Mikhail Vaysman I want it to come up when a message is sent to /app/section/add . - Bleser
  • so you want an integration test? with the launch of the browser, etc.? - Mikhail Vaysman

0