Esempio n. 1
0
  @Test
  public void shouldResolveIndexDescriptor() throws Exception {
    // Given
    Collection<SchemaRule> rules = asList();
    SchemaCache cache = new SchemaCache(rules);

    cache.addSchemaRule(newIndexRule(1l, 1, 2));
    cache.addSchemaRule(newIndexRule(2l, 1, 3));
    cache.addSchemaRule(newIndexRule(3l, 2, 2));

    // When
    try {
      cache.indexDescriptor(9, 9);
      fail(
          "Should have thrown exception saying there's no index descriptor for that label/property");
    } catch (SchemaRuleNotFoundException e) { // Good
    }
    IndexDescriptor descriptor = cache.indexDescriptor(1, 3);

    // Then
    assertEquals(1, descriptor.getLabelId());
    assertEquals(3, descriptor.getPropertyKeyId());
  }