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