@Test
void testRebuild() {

    Map<String, CentralizedRule> rules = new HashMap<>();
    rules.put("r1", new CentralizedRule(rule("r1").withPriority(11), new RandImpl()));
    rules.put("r2", new CentralizedRule(rule("r2"), new RandImpl()));
    List<SamplingRule> inputs = new ArrayList<>();
    inputs.add(rule("r2"));
    inputs.add(rule("r1"));
    inputs.add(rule("r3"));
    CentralizedManifest m = new CentralizedManifest();
    Map<String, CentralizedRule> rebuiltRules = m.rebuild(rules, inputs);
    Assertions.assertEquals(3, rebuiltRules.size());
    String[] orderedList = new String[3];
    rebuiltRules.keySet().toArray(orderedList);
    Assertions.assertEquals("r2", orderedList[0]);
    Assertions.assertEquals("r3", orderedList[1]);
    Assertions.assertEquals("r1", orderedList[2]);
}