Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionOnRelationshipDuplicateRuleFound() throws org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException, org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionOnRelationshipDuplicateRuleFound()
        {
            // GIVEN
            TokenNameLookup tokenNameLookup = DefaultTokenNameLookup;

            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(typeof(DuplicateSchemaRuleException));
            ExpectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple relationship property existence constraints found for -[:Type1(prop1)]-."));

            // WHEN
            schemaStorageSpy.ConstraintsGetSingle(ConstraintDescriptorFactory.existsForRelType(TypeId(TYPE1), PropId(PROP1)));
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionOnNodeDuplicateRuleFound() throws org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException, org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionOnNodeDuplicateRuleFound()
        {
            // GIVEN
            TokenNameLookup tokenNameLookup = DefaultTokenNameLookup;

            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(typeof(DuplicateSchemaRuleException));
            ExpectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple uniqueness constraints found for :Label1(prop1)."));

            // WHEN
            schemaStorageSpy.ConstraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(LabelId(LABEL1), PropId(PROP1)));
        }