AssetController extends BaseController implements CrudController<AssetResource, AssetResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Asset") public AssetResource createResource(@Valid @RequestBody final AssetResource resource) { LOG.info("Creating asset: {}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Asset") AssetResource createResource(@Valid @RequestBody final AssetResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Asset") MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final AssetResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get Asset by id") AssetResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Delete Asset by id") MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Assets") PagedResultResource<AssetResource> getPagedResource(final PagedRequest<AssetResource> request);  }
@Test public void testCreateAsset() throws Exception { AssetResource assetResource = new AssetResource(); String request = getJson(assetResource, true); String response = getJson(assetResource, false); when(facade.createResource(any(AssetResource.class))).thenReturn(assetResource); mockMvc.perform(post("/assets") .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(assetResource); }