예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeStackTraceInUnexpectedCheckException()
            public virtual void ShouldIncludeStackTraceInUnexpectedCheckException()
            {
                // GIVEN
                ConsistencySummaryStatistics summary = mock(typeof(ConsistencySummaryStatistics));
                RecordAccess records = mock(typeof(RecordAccess));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<String> loggedError = new java.util.concurrent.atomic.AtomicReference<>();
                AtomicReference <string> loggedError         = new AtomicReference <string>();
                InconsistencyLogger      logger              = new InconsistencyLoggerAnonymousInnerClass(this, loggedError);
                InconsistencyReport      inconsistencyReport = new InconsistencyReport(logger, summary);
                ConsistencyReporter      reporter            = new ConsistencyReporter(records, inconsistencyReport);
                NodeRecord node = new NodeRecord(10);
                RecordCheck <NodeRecord, ConsistencyReport_NodeConsistencyReport> checker = mock(typeof(RecordCheck));
                Exception exception = new Exception("My specific exception");

                doThrow(exception).when(checker).check(any(typeof(NodeRecord)), any(typeof(CheckerEngine)), any(typeof(RecordAccess)));

                // WHEN
                reporter.ForNode(node, checker);

                // THEN
                assertNotNull(loggedError.get());
                string error = loggedError.get();

                assertThat(error, containsString("at "));
                assertThat(error, containsString(TestName.MethodName));
            }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @SuppressWarnings("unchecked") public void shouldOnlySummarizeStatisticsWhenAllReferencesAreChecked()
            public virtual void ShouldOnlySummarizeStatisticsWhenAllReferencesAreChecked()
            {
                // given
                ConsistencySummaryStatistics summary = mock(typeof(ConsistencySummaryStatistics));
                RecordAccess records = mock(typeof(RecordAccess));

                ConsistencyReporter.ReportHandler handler = new ConsistencyReporter.ReportHandler(new InconsistencyReport(mock(typeof(InconsistencyLogger)), summary), mock(typeof(ConsistencyReporter.ProxyFactory)), RecordType.PROPERTY, records, new PropertyRecord(0), NO_MONITOR);

                RecordReference <PropertyRecord> reference = mock(typeof(RecordReference));
                ComparativeRecordChecker <PropertyRecord, PropertyRecord, ConsistencyReport_PropertyConsistencyReport> checker = mock(typeof(ComparativeRecordChecker));

                handler.comparativeCheck(reference, checker);
                ArgumentCaptor <PendingReferenceCheck <PropertyRecord> > captor = ( ArgumentCaptor )ArgumentCaptor.forClass(typeof(PendingReferenceCheck));

                verify(reference).dispatch(captor.capture());
                PendingReferenceCheck pendingRefCheck = captor.Value;

                // when
                handler.updateSummary();

                // then
                verifyZeroInteractions(summary);

                // when
                pendingRefCheck.skip();

                // then
                verify(summary).update(RecordType.PROPERTY, 0, 0);
                verifyNoMoreInteractions(summary);
            }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSummarizeStatisticsAfterCheck()
            public virtual void ShouldSummarizeStatisticsAfterCheck()
            {
                // given
                ConsistencySummaryStatistics summary = mock(typeof(ConsistencySummaryStatistics));
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") org.neo4j.consistency.store.RecordAccess records = mock(org.neo4j.consistency.store.RecordAccess.class);
                RecordAccess records = mock(typeof(RecordAccess));

                ConsistencyReporter.ReportHandler handler = new ConsistencyReporter.ReportHandler(new InconsistencyReport(mock(typeof(InconsistencyLogger)), summary), mock(typeof(ConsistencyReporter.ProxyFactory)), RecordType.PROPERTY, records, new PropertyRecord(0), NO_MONITOR);

                // when
                handler.updateSummary();

                // then
                verify(summary).update(RecordType.PROPERTY, 0, 0);
                verifyNoMoreInteractions(summary);
            }
예제 #4
0
 public InconsistencyReport(InconsistencyLogger logger, ConsistencySummaryStatistics summary)
 {
     this._logger  = logger;
     this._summary = summary;
 }