PartitionKeyGroupRestController extends HerdBaseController { @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_DELETE) public PartitionKeyGroup deletePartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName) { PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(); partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupName); return partitionKeyGroupService.deletePartitionKeyGroup(partitionKeyGroupKey); }  @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_POST) PartitionKeyGroup createPartitionKeyGroup(@RequestBody PartitionKeyGroupCreateRequest request); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_GET) PartitionKeyGroup getPartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_DELETE) PartitionKeyGroup deletePartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName); @RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_ALL_GET) PartitionKeyGroupKeys getPartitionKeyGroups(); static final String PARTITION_KEY_GROUPS_URI_PREFIX; }
@Test public void testDeletePartitionKeyGroup() { PartitionKeyGroup partitionKeyGroup = new PartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP)); PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey(PARTITION_KEY_GROUP); when(partitionKeyGroupService.deletePartitionKeyGroup(partitionKeyGroupKey)).thenReturn(partitionKeyGroup); PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupRestController.deletePartitionKeyGroup(PARTITION_KEY_GROUP); verify(partitionKeyGroupService).deletePartitionKeyGroup(partitionKeyGroupKey); verifyNoMoreInteractions(partitionKeyGroupService); assertEquals(partitionKeyGroup, deletedPartitionKeyGroup); }