use of org.neo4j.kernel.api.TokenNameLookup in project neo4j by neo4j.
the class SchemaStorageTest method shouldThrowExceptionOnNodeDuplicateRuleFound.
@Test
public void shouldThrowExceptionOnNodeDuplicateRuleFound() throws DuplicateSchemaRuleException, SchemaRuleNotFoundException {
// GIVEN
TokenNameLookup tokenNameLookup = getDefaultTokenNameLookup();
SchemaStorage schemaStorageSpy = Mockito.spy(storage);
Mockito.when(schemaStorageSpy.loadAllSchemaRules(any(), any(), anyBoolean())).thenReturn(Iterators.iterator(getUniquePropertyConstraintRule(1L, LABEL1, PROP1), getUniquePropertyConstraintRule(2L, LABEL1, PROP1)));
//EXPECT
expectedException.expect(DuplicateSchemaRuleException.class);
expectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple uniqueness constraints found for :Label1(prop1)."));
// WHEN
schemaStorageSpy.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(labelId(LABEL1), propId(PROP1)));
}
use of org.neo4j.kernel.api.TokenNameLookup in project neo4j by neo4j.
the class SchemaStorageTest method shouldThrowExceptionOnRelationshipRuleNotFound.
@Test
public void shouldThrowExceptionOnRelationshipRuleNotFound() throws DuplicateSchemaRuleException, SchemaRuleNotFoundException {
TokenNameLookup tokenNameLookup = getDefaultTokenNameLookup();
// EXPECT
expectedException.expect(SchemaRuleNotFoundException.class);
expectedException.expect(new KernelExceptionUserMessageMatcher<>(tokenNameLookup, "No relationship property existence constraint was found for -[:Type1(prop1)]-."));
//WHEN
storage.constraintsGetSingle(ConstraintDescriptorFactory.existsForRelType(typeId(TYPE1), propId(PROP1)));
}
Aggregations