Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowAnExceptionIfTheIndexHasFailed() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowAnExceptionIfTheIndexHasFailed()
        {
            when(_tokenRead.nodeLabel(anyString())).thenReturn(0);
            when(_tokenRead.propertyKey(anyString())).thenReturn(0);
            when(_schemaRead.index(anyInt(), any())).thenReturn(_anyIndex);
            when(_schemaRead.indexGetState(any(typeof(IndexReference)))).thenReturn(FAILED);
            when(_schemaRead.indexGetFailure(any(typeof(IndexReference)))).thenReturn(Exceptions.stringify(new Exception("Kilroy was here")));

            try
            {
                _procedure.awaitIndexByPattern(":Person(name)", TIMEOUT, _timeUnit);
                fail("Expected an exception");
            }
            catch (ProcedureException e)
            {
                assertThat(e.Status(), @is(Org.Neo4j.Kernel.Api.Exceptions.Status_Schema.IndexCreationFailed));
                assertThat(e.Message, containsString(":Person(name)"));
                assertThat(e.Message, containsString("Kilroy was here"));
            }
        }