### Question:
SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flowEntry : rules.getFlowEntries()) { simpleRules.add(buildSimpleSwitchRule(rules.getSwitchId(), flowEntry, meters)); } return simpleRules; }  List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath,
                                                                     EncapsulationId encapsulationId,
                                                                     long flowMeterMinBurstSizeInKbits,
                                                                     double flowMeterBurstCoefficient); List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules,
                                                                              SwitchMeterEntries meters);  }### Answer:
@Test public void shouldConvertFlowEntriesTransitVlanFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForTransitVlan(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesWithTransitVlan(); List<SwitchMeterEntries> switchMeterEntries = getSwitchMeterEntries(); for (int i = 0; i < switchFlowEntries.size(); i++) { List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertSwitchFlowEntriesToSimpleSwitchRules(switchFlowEntries.get(i), switchMeterEntries.get(i)); assertThat(switchRules, hasSize(1)); assertEquals(expectedSwitchRules.get(i), switchRules.get(0)); } }
@Test public void shouldConvertFlowEntriesVxlanFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForVxlan(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesWithVxlan(); List<SwitchMeterEntries> switchMeterEntries = getSwitchMeterEntries(); for (int i = 0; i < switchFlowEntries.size(); i++) { List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertSwitchFlowEntriesToSimpleSwitchRules(switchFlowEntries.get(i), switchMeterEntries.get(i)); assertThat(switchRules, hasSize(1)); assertEquals(expectedSwitchRules.get(i), switchRules.get(0)); } }
@Test public void shouldConvertFlowEntriesOneSwitchFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForOneSwitchFlow(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesOneSwitchFlow(); List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertSwitchFlowEntriesToSimpleSwitchRules(switchFlowEntries.get(0), getSwitchMeterEntriesOneSwitchFlow()); assertEquals(expectedSwitchRules, switchRules); }