SpecOfferSubjectController extends BaseController implements CrudController<SpecOfferSubjectResource, SpecOfferSubjectResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{specOfferId}/subjects", method = RequestMethod.POST) @ApiOperation(value = "Method for creating Spec Offer Subject") public SpecOfferSubjectResource createResource(@Valid @RequestBody final SpecOfferSubjectResource resource) { LOG.info("Creating spec offer subject: {}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{specOfferId}/subjects", method = RequestMethod.POST) @ApiOperation(value = "Method for creating Spec Offer Subject") SpecOfferSubjectResource createResource(@Valid @RequestBody final SpecOfferSubjectResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{specOfferId}/subjects/{specOfferSubjectId}", method = RequestMethod.PUT) @ApiOperation(value = "Update Spec Offer Subject", position = 2) MessageResource updateResource(@PathVariable("specOfferSubjectId") final Long specOfferSubjectId,
 			@RequestBody final SpecOfferSubjectResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{specOfferId}/subjects/{specOfferSubjectId}", method = RequestMethod.GET) @ApiOperation(value = "Get Spec Offer Subjects by spec offer id", position = 3) SpecOfferSubjectResource getResource(@PathVariable("specOfferSubjectId") final Long specOfferSubjectId); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{specOfferId}/subjects/{specOfferSubjectId}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete Spec Offer Subject", position = 4) MessageResource removeResource(@PathVariable("specOfferSubjectId") final Long specOfferSubjectId); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{specOfferId}/subjects", method = RequestMethod.GET) @ApiOperation(value = "Get Spec Offer Subjects") PagedResultResource<SpecOfferSubjectResource> getPagedResource(final PagedRequest<SpecOfferSubjectResource> request);  }
@Test public void testCreateSpecOfferSubject() throws Exception { Long personId = 1L; SpecOfferSubjectResource specOfferSubjectResource = new SpecOfferSubjectResource(); String request = getJson(specOfferSubjectResource, true); String response = getJson(specOfferSubjectResource, false); when(facade.createResource(any(SpecOfferSubjectResource.class))).thenReturn(specOfferSubjectResource); mockMvc.perform(post("/specoffers/{0}/subjects", personId) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(specOfferSubjectResource); }