Exemplo n.º 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()));
  }
Exemplo n.º 2
0
  @Test
  public void should_add_schema_rules_to_a_label() {
    // GIVEN
    Collection<SchemaRule> rules = asList();
    SchemaCache cache = new SchemaCache(rules);

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

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