### Question:
EnvoySentinelRuleConverter { public static List<FlowRule> toSentinelFlowRules(EnvoyRlsRule rule) { if (!EnvoyRlsRuleManager.isValidRule(rule)) { throw new IllegalArgumentException("Not a valid RLS rule"); } return rule.getDescriptors().stream() .map(e -> toSentinelFlowRule(rule.getDomain(), e)) .collect(Collectors.toList()); } private  EnvoySentinelRuleConverter(); static List<FlowRule> toSentinelFlowRules(EnvoyRlsRule rule); static FlowRule toSentinelFlowRule(String domain, EnvoyRlsRule.ResourceDescriptor descriptor); static long generateFlowId(String key); static String generateKey(String domain, EnvoyRlsRule.ResourceDescriptor descriptor); static final String SEPARATOR; }### Answer:
@Test public void testConvertToSentinelFlowRules() { String domain = "testConvertToSentinelFlowRules"; EnvoyRlsRule rlsRule = new EnvoyRlsRule(); rlsRule.setDomain(domain); List<ResourceDescriptor> descriptors = new ArrayList<>(); ResourceDescriptor d1 = new ResourceDescriptor(); d1.setCount(10d); d1.setResources(Collections.singleton(new KeyValueResource("k1", "v1"))); descriptors.add(d1); ResourceDescriptor d2 = new ResourceDescriptor(); d2.setCount(20d); d2.setResources(new HashSet<>(Arrays.asList( new KeyValueResource("k2", "v2"), new KeyValueResource("k3", "v3") ))); descriptors.add(d2); rlsRule.setDescriptors(descriptors); List<FlowRule> rules = EnvoySentinelRuleConverter.toSentinelFlowRules(rlsRule); final String expectedK1 = domain + SEPARATOR + "k1" + SEPARATOR + "v1"; FlowRule r1 = rules.stream() .filter(e -> e.getResource().equals(expectedK1)) .findAny() .orElseThrow(() -> new AssertionError("the converted rule does not exist, expected key: " + expectedK1)); assertEquals(10d, r1.getCount(), 0.01); final String expectedK2 = domain + SEPARATOR + "k2" + SEPARATOR + "v2" + SEPARATOR + "k3" + SEPARATOR + "v3"; FlowRule r2 = rules.stream() .filter(e -> e.getResource().equals(expectedK2)) .findAny() .orElseThrow(() -> new AssertionError("the converted rule does not exist, expected key: " + expectedK2)); assertEquals(20d, r2.getCount(), 0.01); }