Exemple #1
0
  @Test
  public void should_construct_schema_cache() {
    // GIVEN
    Collection<SchemaRule> rules = asList(hans, witch, gretel);
    SchemaCache cache = new SchemaCache(rules);

    // THEN
    assertEquals(asSet(hans, gretel), asSet(cache.schemaRulesForLabel(0)));
    assertEquals(asSet(witch), asSet(cache.schemaRulesForLabel(3)));
    assertEquals(asSet(rules), asSet(cache.schemaRules()));
  }
Exemple #2
0
  @Test
  public void should_to_retrieve_all_schema_rules() {
    // GIVEN
    Collection<SchemaRule> rules = asList();
    SchemaCache cache = new SchemaCache(rules);

    // WHEN
    cache.addSchemaRule(hans);
    cache.addSchemaRule(gretel);

    // THEN
    assertEquals(asSet(hans, gretel), asSet(cache.schemaRules()));
  }