/** * Finalize storage by ID. * <p> * <i> Example URL: /storage/{id}/finalize</i> * * @param id * ID bounded from path. * @throws BusinessException * If {@link BusinessException} occurs. * @return Message for the user. */ @RequestMapping(method = GET, value = "{id}/finalize") @ResponseBody public Object finalizeStorage(@PathVariable String id) throws BusinessException { StorageData storageData = new StorageData(); storageData.setId(id); storageService.closeStorage(storageData); return Collections.singletonMap("message", "Storage id " + id + " successfully finalized."); }
@Test public void finalizeStorage() throws BusinessException { String id = "id"; restfulService.finalizeStorage(id); ArgumentCaptor<StorageData> captor = ArgumentCaptor.forClass(StorageData.class); verify(storageService, times(1)).closeStorage(captor.capture()); assertThat(captor.getValue().getId(), is(id)); }