### Question:
NamingServiceResources { public String generateServiceInstanceName(NamingRequestObject namingRequestObject) throws BadResponseException, IOException { HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap(); Element element = new Element(); nsRequestObject.forEach(element::put); 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 generateServiceInstanceNameTest() throws Exception { NameGenRequest req = new NameGenRequest(); doReturn("generatedServiceInstanceName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class)); doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class)); NamingRequestObject nrObject = new NamingRequestObject(); nrObject.setExternalKeyValue("testExternalKey"); nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE); nrObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME); nrObject.setPolicyInstanceNameValue(execution.getVariable("policyInstanceName")); nrObject.setServiceModelNameValue("testServiceInstanceModelName"); nrObject.setModelVersionValue("testServiceInstanceModelVersion"); nrObject.setZoneIdValue(execution.getVariable("zoneId")); String generatedName = namingServiceResources.generateServiceInstanceName(nrObject); verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class)); assertEquals("generatedServiceInstanceName", generatedName); }