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