### Question:
AuditVServer extends AbstractAudit { public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) { AAIObjectAuditList auditList = new AAIObjectAuditList(); AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModules()) .queryParam("vf-module-name", vfModuleName); Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri); if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) { List<AAIResourceUri> relatedVservers = wrapper.get().getRelationships().get().getRelatedUris(Types.VSERVER); if (!relatedVservers.isEmpty()) { relatedVservers.forEach(vserverUri -> { Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class); Vserver vServerShallow = new Vserver(); BeanUtils.copyProperties(vserver, vServerShallow); AAIObjectAudit vServerAudit = new AAIObjectAudit(); vServerAudit.setAaiObject(vServerShallow); vServerAudit.setAaiObjectType(Types.VSERVER.typeName()); vServerAudit.setDoesObjectExist(true); auditList.getAuditList().add(vServerAudit); }); } } return Optional.of(auditList); }  void auditVservers(AAIObjectAuditList aaiObjectAuditList); Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName); Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner,
            String cloudRegion);  }### Answer:
@Test public void testAuditVserversThroughRelationships() { VfModule vfModule = new VfModule(); vfModule.setVfModuleId("id"); AAIResultWrapper wrapper = new AAIResultWrapper(vfModule); doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules()) .queryParam("vf-module-name", "vfModuleName")); Optional<AAIObjectAuditList> auditList = auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName"); Assert.assertTrue(auditList.get().getAuditList().isEmpty()); }
@Test public void testAuditVserversThroughRelationships_exists() throws IOException { String vfModule = getJson("vfModule.json"); AAIResultWrapper wrapper = new AAIResultWrapper(vfModule); AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver()); doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules()) .queryParam("vf-module-name", "vfModuleName")); doReturn(vserverWrapper).when(aaiResourcesMock) .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() .cloudRegion("cloud-owner", "cloud-region-id").tenant("tenant-id").vserver("VUSCHGA1"))); Optional<AAIObjectAuditList> auditList = auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName"); Assert.assertFalse(auditList.get().getAuditList().isEmpty()); }