### Question:
Sol003GrantController { @PostMapping(value = "/grants") public ResponseEntity<InlineResponse201> grantsPost(@RequestBody final GrantRequest grantRequest) { logger.info("Grant request received from VNFM: " + grantRequest); final InlineResponse201 grantResponse = createGrantResponse(grantRequest); logger.info("Grant request returning to VNFM: " + grantResponse); return new ResponseEntity<>(grantResponse, HttpStatus.CREATED); } @Autowired  Sol003GrantController(final AaiServiceProvider aaiServiceProvider, final AaiHelper aaiHelper,
            final VnfmHelper vnfmHelper); @GetMapping(value = "/grants/{grantId}") ResponseEntity<InlineResponse201> grantsGrantIdGet(@PathVariable("grantId") final String grantId); @PostMapping(value = "/grants") ResponseEntity<InlineResponse201> grantsPost(@RequestBody final GrantRequest grantRequest); final AaiServiceProvider aaiServiceProvider; final AaiHelper aaiHelper; final VnfmHelper vnfmHelper; }### Answer:
@Test public void grantRequest_ValidRequestInstantiate_GrantApproved() { final GrantRequest grantRequest = createGrantRequest("INSTANTIATE"); setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1"); final ResponseEntity<InlineResponse201> response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); assertEquals(1, response.getBody().getAddResources().size()); assertNull(response.getBody().getRemoveResources()); assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId()); assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); assertEquals("123456", response.getBody().getVnfLcmOpOccId()); final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); assertEquals(vimConnectionId, vimConnections.getVimId()); assertEquals("OPENSTACK", vimConnections.getVimType()); assertNotNull(vimConnections.getAccessInfo()); assertNotNull(vimConnections.getInterfaceInfo()); assertEquals("INSTANTIATE", grantRequest.getOperation().toString()); }
@Test public void grantRequest_ValidRequestTerminate_GrantApproved() { final GrantRequest grantRequest = createGrantRequest("TERMINATE"); setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1"); final ResponseEntity<InlineResponse201> response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); assertNull(response.getBody().getAddResources()); assertEquals(1, response.getBody().getRemoveResources().size()); assertEquals(vimConnectionId, response.getBody().getRemoveResources().get(0).getVimConnectionId()); assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); assertEquals("123456", response.getBody().getVnfLcmOpOccId()); final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); assertEquals(vimConnectionId, vimConnections.getVimId()); assertEquals("OPENSTACK", vimConnections.getVimType()); assertNotNull(vimConnections.getAccessInfo()); assertNotNull(vimConnections.getInterfaceInfo()); assertEquals("TERMINATE", grantRequest.getOperation().toString()); }