### Question:
NamingServiceResources { public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException { Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName()); List<Element> elements = new ArrayList<>(); elements.add(element); return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements))); }  String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode); String deleteInstanceGroupName(InstanceGroup instanceGroup); String generateServiceInstanceName(NamingRequestObject namingRequestObject); String deleteServiceInstanceName(NamingRequestObject namingRequestObject);  }### Answer:
@Test public void generateInstanceGroupNameTest() throws Exception { NameGenResponse name = new NameGenResponse(); ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK); Element element = new Element(); NameGenRequest req = new NameGenRequest(); doReturn(element).when(MOCK_namingRequestObjectBuilder).elementMapper(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); doReturn("generatedInstanceGroupName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class)); doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class)); String generatedName = namingServiceResources.generateInstanceGroupName(instanceGroup, "policyInstanceName", "nfNamingCode"); verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class)); assertEquals(generatedName, "generatedInstanceGroupName"); }