BroadcastingController extends BaseController implements CrudController<BroadcastingMessageResource, BroadcastingMessageResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) public BroadcastingMessageResource createResource(@Valid @RequestBody final BroadcastingMessageResource resource) { LOG.info("Creating new broadcast: {}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) PagedResultResource<BroadcastingMessageResource> getPagedResource(final PagedRequest<BroadcastingMessageResource> request); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) BroadcastingMessageResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) BroadcastingMessageResource createResource(@Valid @RequestBody final BroadcastingMessageResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id, 
			@Valid @RequestBody final BroadcastingMessageResource resource); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id);  }
@Test public void testCreateBroadcastingMessage() throws Exception { Long group1 = 1L; Long group2 = 2L; List<Long> groups = Arrays.asList(group1, group2); String recipient1 = "recipient1@edu.lviv.ua"; String recipient2 = "recipient2@edu.lviv.ua"; List<String> recipient = Arrays.asList(recipient1, recipient2); String content = "content"; String topic = "topic"; BroadcastingMessageResource resource = new BroadcastingMessageResource(); resource.setContent(content); resource.setTopic(topic); resource.setRecipients(recipient); resource.setGroups(groups); String request = getJson(resource, true); String response = getJson(resource, false); when(facade.createResource(any(BroadcastingMessageResource.class))).thenReturn(resource); mockMvc.perform(post("/broadcastings") .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(resource); }