### Question:
SecurityAccessManifester { public void overrideSecurityAccess(InstanceGroupType instanceGroupType, List<InstanceGroupV4Request> instanceGroups, String securityGroupId, String cidrs) { instanceGroups.stream() .filter(ig -> ig.getType() == instanceGroupType) .findFirst() .ifPresent(ig -> { SecurityGroupV4Request securityGroup = ig.getSecurityGroup(); if (securityGroup == null) { securityGroup = new SecurityGroupV4Request(); } if (!internalApiCallCalculator.isInternalApiCall(securityGroup)) { if (!Strings.isNullOrEmpty(securityGroupId)) { securityGroup.setSecurityGroupIds(Set.of(securityGroupId)); securityGroup.setSecurityRules(new ArrayList<>()); } else if (!Strings.isNullOrEmpty(cidrs)) { List<SecurityRuleV4Request> generatedSecurityRules = new ArrayList<>(); List<SecurityRuleV4Request> originalSecurityRules = securityGroup.getSecurityRules(); for (String cidr : CidrUtil.cidrs(cidrs)) { SecurityRuleUtil.propagateCidr(generatedSecurityRules, originalSecurityRules, cidr); } if (originalSecurityRules != null) { securityGroup.setSecurityRules(generatedSecurityRules); } securityGroup.setSecurityGroupIds(new HashSet<>()); } else { securityGroup.setSecurityGroupIds(new HashSet<>()); securityGroup.setSecurityRules(new ArrayList<>()); } } }); }  void overrideSecurityAccess(InstanceGroupType instanceGroupType, List<InstanceGroupV4Request> instanceGroups, String securityGroupId, String cidrs);  }### Answer:
@Test void overrideSecurityAccessWhenOneCidrRangeProvidedThenShouldUpdateTheCidrRange() { InstanceGroupType gateway = InstanceGroupType.GATEWAY; List<InstanceGroupV4Request> instanceGroups = getInstanceGroups(); String theWholeWorld = "0.0.0.0/0"; securityAccessManifester.overrideSecurityAccess(gateway, instanceGroups, null, theWholeWorld); assertEquals(1, instanceGroups.get(0).getSecurityGroup().getSecurityRules().size()); assertEquals(List.of(theWholeWorld), collectSubnets(instanceGroups)); }
@Test void overrideSecurityAccessWhenMultipleCidrRangeProvidedThenShouldUpdateTheCidrRanges() { InstanceGroupType gateway = InstanceGroupType.GATEWAY; List<InstanceGroupV4Request> instanceGroups = getInstanceGroups(); String theWholeWorldAndASimpleCidr = "0.0.0.0/0,172.16.0.0/16"; securityAccessManifester.overrideSecurityAccess(gateway, instanceGroups, null, theWholeWorldAndASimpleCidr); assertEquals(2, instanceGroups.get(0).getSecurityGroup().getSecurityRules().size()); assertEquals(List.of(theWholeWorldAndASimpleCidr.split(",")), collectSubnets(instanceGroups)); }